Package io.fluentlenium.core.domain
Class FluentListImpl<E extends FluentWebElement>
java.lang.Object
io.fluentlenium.core.domain.ListImpl<T>
io.fluentlenium.core.domain.DelegatingList<T>
io.fluentlenium.core.domain.ComponentList<E>
io.fluentlenium.core.domain.FluentListImpl<E>
- Type Parameters:
E- type of fluent element the list contains
- All Implemented Interfaces:
FluentActions<FluentList<E>,,E> FluentJavascriptActions,LazyComponents,FluentList<E>,WrapsElements,HookControl<FluentList<E>>,FluentLabel<FluentList<E>>,FluentProxyState<FluentList<E>>,SearchControl<E>,Iterable<E>,Collection<E>,List<E>
public class FluentListImpl<E extends FluentWebElement>
extends ComponentList<E>
implements FluentList<E>
Default implementation of
FluentList and ComponentList.
It offers convenience methods to work with a collection of elements, like click(), submit(), value() ...
It also offers capability to add labels and hooks to an object having this type.
-
Field Summary
Fields inherited from class io.fluentlenium.core.domain.ComponentList
componentClass, control, instantiator, proxyFields inherited from class io.fluentlenium.core.domain.DelegatingList
list -
Constructor Summary
ConstructorsConstructorDescriptionFluentListImpl(Class<E> componentClass, List<E> list, FluentControl control, ComponentInstantiator instantiator) Creates a new fluent list. -
Method Summary
Modifier and TypeMethodDescriptionWrap raw selenium elements into a list of elements.<T extends FluentWebElement>
FluentList<T>Wrap all underlying elements in a component.await()Build a wait object to wait for a condition of this element list.Build a condition object on this element list that will match if each underlying element match, automatically waiting for condition to be verified.Build a condition object on this element list that will match if one or more underlying element match, automatically waiting for condition to be verified.voidclear()Clear visible elements on the listclearAll()Clear all elements on the listClear all React elements on the listvoidCallsList.clear()from underlying List implementation.click()Click on all elements on the list Only the clickable elements are clickedcontext click on all elements on the list Only the clickable elements are clickedintcount()Count elements without actually loading the lazy list.double click on all elements on the list Only the clickable elements are clickedeach()Build a condition object on this element list that will match if each underlying element match.el(org.openqa.selenium.WebElement rawElement) Wrap existing raw selenium element into an element.fill()Construct a Fill Builder in order to allow easy fill of visible input fields.Construct a Fill Select Builder in order to allow easy fill of visible input fields.find(SearchFilter... filters) find elements in the children with the corresponding filtersfind(String selector, SearchFilter... filters) find elements into the children with the corresponding filtersWrap raw selenium elements into a list of elements.find(org.openqa.selenium.By locator, SearchFilter... filters) Find list of elements with Selenium locator and filters.first()Retrieve the first element.frame()Select a frame using this element.get(int index) index(int index) Retrieve an element at given index.last()Retrieve the last element.booleanloaded()Check if the element is loaded.modifyAttribute(String attributeName, String attributeValue) Modifies attributes of first element onlynoHook()Disable all hooks from actual element.noHook(Class<? extends FluentHook>... hooks) Disable given hook from actual element.<R> RnoHook(Class<? extends FluentHook> hook, Function<FluentList<E>, R> function) Invoke a function with no hook.<R> RnoHook(Function<FluentList<E>, R> function) Invoke a function with no hook.Creates a new element locator instance with all hooks disabled.noHookInstance(Class<? extends FluentHook>... hooks) Creates a new element locator instance with given hook disabled.now()Search for the element now, actually performing the search on theWebDriver.now(boolean force) Search for the element now, actually performing the search on theWebDriver.one()Build a condition object on this element list that will match if one or more underlying element match.optional()Builds an optional.booleanpresent()Check if the element is present in the DOM.reset()Reset the element.Retore hooks that were defined initially.Scrolls to first element of listscrollIntoView(boolean alignWithTop) Scrolls to first element of listScrolls to first element of listsingle()Retrieve the first element and checks is it exactly one element in the listsubmit()submit on all elements on the list Only the visible elements are submittedtoString()Helper method that: a) waits at most 5 seconds for element b) scrolls centrally into it c) clicks on itwaitAndClick(Duration duration) Helper method that: a) waits for element b) scrolls centrally into it c) clicks on it<O,H extends FluentHook<O>>
FluentList<E>Enable a hook with default options.<O,H extends FluentHook<O>>
FluentList<E>Enable a hook with given options.Apply a label that will be displayed as the representation of this object for error message.withLabelHint(String... labelHint) Add a label hint that will be appended to the representation of this object for error message.Fill all elements on the list with the corresponding cell in the with array.Methods inherited from class io.fluentlenium.core.domain.ComponentList
addLazyComponentsListener, getWrappedElements, isLazy, isLazyInitialized, removeLazyComponentsListenerMethods inherited from class io.fluentlenium.core.domain.DelegatingList
getListMethods inherited from class io.fluentlenium.core.domain.ListImpl
add, add, addAll, addAll, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface io.fluentlenium.core.domain.FluentList
attributes, dimensions, hoverOver, ids, names, tagNames, textContents, texts, toElements, valuesMethods inherited from interface java.util.List
add, add, addAll, addAll, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
FluentListImpl
public FluentListImpl(Class<E> componentClass, List<E> list, FluentControl control, ComponentInstantiator instantiator) Creates a new fluent list.- Parameters:
componentClass- component classlist- list of fluent elementcontrol- control interfaceinstantiator- component instantiator
-
-
Method Details
-
await
Description copied from interface:FluentListBuild a wait object to wait for a condition of this element list.- Specified by:
awaitin interfaceFluentList<E extends FluentWebElement>- Returns:
- a wait object
-
first
Description copied from interface:FluentListRetrieve the first element.- Specified by:
firstin interfaceFluentList<E extends FluentWebElement>- Returns:
- first element
-
single
Description copied from interface:FluentListRetrieve the first element and checks is it exactly one element in the list- Specified by:
singlein interfaceFluentList<E extends FluentWebElement>- Returns:
- first element
-
last
Description copied from interface:FluentListRetrieve the last element.- Specified by:
lastin interfaceFluentList<E extends FluentWebElement>- Returns:
- last element
-
get
- Specified by:
getin interfaceList<E extends FluentWebElement>- Overrides:
getin classListImpl<E extends FluentWebElement>
-
index
Description copied from interface:FluentListRetrieve an element at given index.- Specified by:
indexin interfaceFluentList<E extends FluentWebElement>- Parameters:
index- position of the element to retrieve- Returns:
- element at given index
-
count
public int count()Description copied from interface:FluentListCount elements without actually loading the lazy list.This method ignore defined hooks.
- Specified by:
countin interfaceFluentList<E extends FluentWebElement>- Returns:
- elements count
-
present
public boolean present()Description copied from interface:FluentProxyStateCheck if the element is present in the DOM.- Specified by:
presentin interfaceFluentProxyState<E extends FluentWebElement>- Returns:
- true if the element is present, false otherwise
-
now
Description copied from interface:FluentProxyStateSearch for the element now, actually performing the search on theWebDriver.It has no effect if the element is already loaded.
- Specified by:
nowin interfaceFluentProxyState<E extends FluentWebElement>- Returns:
- this object reference to chain calls.
-
now
Description copied from interface:FluentProxyStateSearch for the element now, actually performing the search on theWebDriver.It has no effect if the element is already loaded.
- Specified by:
nowin interfaceFluentProxyState<E extends FluentWebElement>- Parameters:
force- force the search even if element is already loaded- Returns:
- this object reference to chain calls.
-
reset
Description copied from interface:FluentProxyStateReset the element. Subsequent calls will perform the search again, instead of using the cached result.- Specified by:
resetin interfaceFluentProxyState<E extends FluentWebElement>- Returns:
- this object reference to chain calls.
-
loaded
public boolean loaded()Description copied from interface:FluentProxyStateCheck if the element is loaded.- Specified by:
loadedin interfaceFluentProxyState<E extends FluentWebElement>- Returns:
- true if the element is loaded, false otherwise
-
click
Description copied from interface:FluentListClick on all elements on the list Only the clickable elements are clicked- Specified by:
clickin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Specified by:
clickin interfaceFluentList<E extends FluentWebElement>- Returns:
- the current instance of FluentList to provide capability for chaining calls
- See Also:
-
doubleClick
Description copied from interface:FluentListdouble click on all elements on the list Only the clickable elements are clicked- Specified by:
doubleClickin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Specified by:
doubleClickin interfaceFluentList<E extends FluentWebElement>- Returns:
- the current instance of FluentList to provide capability for chaining calls
-
contextClick
Description copied from interface:FluentListcontext click on all elements on the list Only the clickable elements are clicked- Specified by:
contextClickin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Specified by:
contextClickin interfaceFluentList<E extends FluentWebElement>- Returns:
- the current instance of FluentList to provide capability for chaining calls
-
waitAndClick
Description copied from interface:FluentActionsHelper method that: a) waits at most 5 seconds for element b) scrolls centrally into it c) clicks on it- Specified by:
waitAndClickin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Returns:
- this object reference to chain methods calls
-
waitAndClick
Description copied from interface:FluentActionsHelper method that: a) waits for element b) scrolls centrally into it c) clicks on it- Specified by:
waitAndClickin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Parameters:
duration- - enabled to override default 5 seconds of waiting- Returns:
- this object reference to chain methods calls
-
write
Description copied from interface:FluentListFill all elements on the list with the corresponding cell in the with array. Only the visible elements are filled If there are more elements on the list than in the with array, the last element of the table is repeated- Specified by:
writein interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Specified by:
writein interfaceFluentList<E extends FluentWebElement>- Parameters:
with- one or many text to send.- Returns:
- the current instance of FluentList to provide capability for chaining calls
- See Also:
-
clearAll
Description copied from interface:FluentListClear all elements on the listOnly the visible elements are cleared.
- Specified by:
clearAllin interfaceFluentList<E extends FluentWebElement>- Returns:
- extended by FluentWebElement object
-
clearAllReactInputs
Description copied from interface:FluentListClear all React elements on the listOnly the visible elements are cleared.
- Specified by:
clearAllReactInputsin interfaceFluentList<E extends FluentWebElement>- Returns:
- extended by FluentWebElement object
-
clearList
public void clearList()Description copied from interface:FluentListCallsList.clear()from underlying List implementation.- Specified by:
clearListin interfaceFluentList<E extends FluentWebElement>- See Also:
-
each
Description copied from interface:FluentListBuild a condition object on this element list that will match if each underlying element match.- Specified by:
eachin interfaceFluentList<E extends FluentWebElement>- Returns:
- a condition object
-
one
Description copied from interface:FluentListBuild a condition object on this element list that will match if one or more underlying element match.- Specified by:
onein interfaceFluentList<E extends FluentWebElement>- Returns:
- a condition object
-
awaitUntilEach
Description copied from interface:FluentListBuild a condition object on this element list that will match if each underlying element match, automatically waiting for condition to be verified.- Specified by:
awaitUntilEachin interfaceFluentList<E extends FluentWebElement>- Returns:
- a condition object
-
awaitUntilOne
Description copied from interface:FluentListBuild a condition object on this element list that will match if one or more underlying element match, automatically waiting for condition to be verified.- Specified by:
awaitUntilOnein interfaceFluentList<E extends FluentWebElement>- Returns:
- a condition object
-
submit
Description copied from interface:FluentListsubmit on all elements on the list Only the visible elements are submitted- Specified by:
submitin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Specified by:
submitin interfaceFluentList<E extends FluentWebElement>- Returns:
- the current instance of FluentList to provide capability for chaining calls
- See Also:
-
find
Description copied from interface:SearchControlWrap raw selenium elements into a list of elements.- Specified by:
findin interfaceSearchControl<E extends FluentWebElement>- Parameters:
rawElements- raw selenium elements- Returns:
- list of element
-
$
Description copied from interface:SearchControlWrap raw selenium elements into a list of elements.- Specified by:
$in interfaceSearchControl<E extends FluentWebElement>- Parameters:
rawElements- raw selenium elements- Returns:
- list of element
-
el
Description copied from interface:SearchControlWrap existing raw selenium element into an element.- Specified by:
elin interfaceSearchControl<E extends FluentWebElement>- Parameters:
rawElement- raw selenium element- Returns:
- element
-
find
Description copied from interface:FluentListfind elements into the children with the corresponding filters- Specified by:
findin interfaceFluentList<E extends FluentWebElement>- Specified by:
findin interfaceSearchControl<E extends FluentWebElement>- Parameters:
selector- element namefilters- set of filters- Returns:
- extended by FluentWebElement objects list
-
find
Description copied from interface:SearchControlFind list of elements with Selenium locator and filters.- Specified by:
findin interfaceSearchControl<E extends FluentWebElement>- Parameters:
locator- elements locatorfilters- filters set- Returns:
- list of elements
-
find
Description copied from interface:FluentListfind elements in the children with the corresponding filters- Specified by:
findin interfaceFluentList<E extends FluentWebElement>- Specified by:
findin interfaceSearchControl<E extends FluentWebElement>- Parameters:
filters- set of filters- Returns:
- extended by FluentWebElement objects list
-
fill
Description copied from interface:FluentActionsConstruct a Fill Builder in order to allow easy fill of visible input fields.- Specified by:
fillin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Returns:
- Fill builder
-
fillSelect
Description copied from interface:FluentActionsConstruct a Fill Select Builder in order to allow easy fill of visible input fields.- Specified by:
fillSelectin interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Returns:
- Fill select builder
-
frame
Description copied from interface:FluentActionsSelect a frame using this element.- Specified by:
framein interfaceFluentActions<FluentList<E extends FluentWebElement>,E extends FluentWebElement> - Returns:
- this object reference to chain methods calls.
-
optional
Description copied from interface:FluentProxyStateBuilds an optional. If underlying element is lazy, search will be perfomed when invoking this method.- Specified by:
optionalin interfaceFluentProxyState<E extends FluentWebElement>- Returns:
- An optional wrapping this.
- See Also:
-
as
Description copied from interface:FluentListWrap all underlying elements in a component.- Specified by:
asin interfaceFluentList<E extends FluentWebElement>- Type Parameters:
T- type of component- Parameters:
componentClass- component class- Returns:
- fluent list of elements as components.
-
clear
public void clear()Description copied from interface:FluentListClear visible elements on the list- Specified by:
clearin interfaceCollection<E extends FluentWebElement>- Specified by:
clearin interfaceFluentList<E extends FluentWebElement>- Specified by:
clearin interfaceList<E extends FluentWebElement>- Overrides:
clearin classListImpl<E extends FluentWebElement>
-
toString
-
withLabel
Description copied from interface:FluentLabelApply a label that will be displayed as the representation of this object for error message.- Specified by:
withLabelin interfaceFluentLabel<E extends FluentWebElement>- Parameters:
label- label to use- Returns:
- reference to this object to chain calls
-
withLabelHint
Description copied from interface:FluentLabelAdd a label hint that will be appended to the representation of this object for error message.- Specified by:
withLabelHintin interfaceFluentLabel<E extends FluentWebElement>- Parameters:
labelHint- label hints to add- Returns:
- reference to this object to chain calls
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with all hooks disabled.- Specified by:
noHookInstancein interfaceHookControl<E extends FluentWebElement>- Returns:
- new element locator with hook disabled.
-
noHook
Description copied from interface:HookControlDisable all hooks from actual element.- Specified by:
noHookin interfaceHookControl<E extends FluentWebElement>- Returns:
- this object reference to chain calls
-
withHook
Description copied from interface:HookControlEnable a hook with default options.- Specified by:
withHookin interfaceHookControl<E extends FluentWebElement>- Type Parameters:
O- Type of the hookH- Type of the hook options- Parameters:
hook- hook class to enable- Returns:
- this object reference to chain calls
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<E extends FluentWebElement>- Type Parameters:
R- return type- Parameters:
hook- hook class to disablefunction- function to invoke- Returns:
- return value of the given function
-
restoreHooks
Description copied from interface:HookControlRetore hooks that were defined initially.- Specified by:
restoreHooksin interfaceHookControl<E extends FluentWebElement>- Returns:
- this object reference to chain calls
-
withHook
Description copied from interface:HookControlEnable a hook with given options.- Specified by:
withHookin interfaceHookControl<E extends FluentWebElement>- Type Parameters:
O- Type of the hookH- Type of the hook options- Parameters:
hook- hook class to enableoptions- hook options to apply- Returns:
- this object reference to chain calls
-
noHook
Description copied from interface:HookControlDisable given hook from actual element.- Specified by:
noHookin interfaceHookControl<E extends FluentWebElement>- Parameters:
hooks- hook classes to disable- Returns:
- this object reference to chain calls
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with given hook disabled.- Specified by:
noHookInstancein interfaceHookControl<E extends FluentWebElement>- Parameters:
hooks- hook classes to disable- Returns:
- new element locator with hook disabled.
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<E extends FluentWebElement>- Type Parameters:
R- return type- Parameters:
function- function to invoke- Returns:
- return value of the given function
-
scrollToCenter
Scrolls to first element of list- Specified by:
scrollToCenterin interfaceFluentJavascriptActions<E extends FluentWebElement>- Returns:
- this object reference to chain methods calls
-
scrollIntoView
Scrolls to first element of list- Specified by:
scrollIntoViewin interfaceFluentJavascriptActions<E extends FluentWebElement>- Parameters:
alignWithTop- If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. If false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor.- Returns:
- this object reference to chain methods calls
- See Also:
-
modifyAttribute
Modifies attributes of first element only- Specified by:
modifyAttributein interfaceFluentJavascriptActions<E extends FluentWebElement>- Parameters:
attributeName- attribute to be changeattributeValue- new attribute value- Returns:
- this object reference to chain methods calls
-
scrollIntoView
Scrolls to first element of list- Specified by:
scrollIntoViewin interfaceFluentJavascriptActions<E extends FluentWebElement>- Returns:
- this object reference to chain methods calls
- See Also:
-