Package io.fluentlenium.core.domain
Class FluentWebElement
java.lang.Object
io.fluentlenium.core.domain.Component
io.fluentlenium.core.domain.FluentWebElement
- All Implemented Interfaces:
FluentActions<FluentWebElement,,FluentWebElement> FluentJavascriptActions,AlertControl,CapabilitiesControl,ComponentInstantiator,CssControl,EventsControl,HookControl<FluentWebElement>,FluentInjectControl,FluentLabel<FluentWebElement>,NavigationControl,FluentProxyState<FluentWebElement>,JavascriptControl,SearchControl<FluentWebElement>,SeleniumDriverControl,SnapshotControl,org.openqa.selenium.WrapsElement
public class FluentWebElement
extends Component
implements org.openqa.selenium.WrapsElement, FluentActions<FluentWebElement,FluentWebElement>, FluentProxyState<FluentWebElement>, SearchControl<FluentWebElement>, HookControl<FluentWebElement>, FluentLabel<FluentWebElement>, NavigationControl, JavascriptControl, AlertControl, SnapshotControl, EventsControl, SeleniumDriverControl, CssControl, FluentInjectControl, CapabilitiesControl, ComponentInstantiator
Wraps a Selenium
WebElement. It provides an enhanced API to control selenium element.-
Field Summary
Fields inherited from class io.fluentlenium.core.domain.Component
control, instantiator, webElement -
Constructor Summary
ConstructorsConstructorDescriptionFluentWebElement(org.openqa.selenium.WebElement element, FluentControl control, ComponentInstantiator instantiator) Creates a new fluent web element.FluentWebElement(org.openqa.selenium.WebElement element, FluentControl control, ComponentInstantiator instantiator, org.openqa.selenium.interactions.Actions actions) Creates a new fluent web element. -
Method Summary
Modifier and TypeMethodDescriptionalert()Get an object to control the alert window.<T> TWrap all underlying elements in a component.<L extends List<T>,T>
LasComponentList(Class<L> listClass, Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Create and register a new list of component from the given element iterable.<L extends List<T>,T>
LasComponentList(Class<L> listClass, Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Create and register a new list of component from the given element iterable.<L extends List<T>,T>
LasComponentList(Class<L> listClass, Class<T> componentClass, org.openqa.selenium.WebElement... elements) Create and register a new list of component from the given element iterable.<T> ComponentListasComponentList(Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Create and register a new list of component from the given element iterable.<T> ComponentList<T>asComponentList(Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Create and register a new list of component from the given element iterable.<T> ComponentList<T>asComponentList(Class<T> componentClass, org.openqa.selenium.WebElement... elements) Create and register a new list of component from the given element iterable.<T extends FluentWebElement>
FluentList<T>asFluentList(Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Create and register a new fluent list.<T extends FluentWebElement>
FluentList<T>asFluentList(Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Create and register a new fluent list.<T extends FluentWebElement>
FluentList<T>asFluentList(Class<T> componentClass, org.openqa.selenium.WebElement... elements) Create and register a new fluent list.asFluentList(Iterable<org.openqa.selenium.WebElement> elements) Create and register a new fluent list from the argument collection of WebElements.asFluentList(List<org.openqa.selenium.WebElement> elements) Create and register a new fluent list from the argument list of WebElements.asFluentList(org.openqa.selenium.WebElement... elements) Create and register a new fluent list from the argument WebElements.asList()Converts this element as a single element list.return any value of custom attribute (generated=true will return "true" if attribute("generated") is called.await()Build a wait object to wait for a condition of this element.axes()Deprecated.booleanCheck if underlyingWebDrivercan take screenshot.org.openqa.selenium.CapabilitiesGet the actual capabilities of the underlying Selenium WebDriver.clear()Clear the elementClear React input using Backspace onlyclick()Perform a click.booleanCheck that this element is visible and enabled such that you can click it.Get a conditions object used to verify condition on this element.Perform a context click.css()Features related to CSS loaded in the active page.Get the value of a given CSS property.booleanreturn true if the element is displayed, other way return falsedom()XPath Axes accessor (parent, ancestors, preceding, following, ...).Perform a double click.el(org.openqa.selenium.WebElement rawElement) Wrap existing raw selenium element into an element.booleanenabled()return true if the element is enabled, other way return falseevents()Retrieves an event registry to register event listeners.executeAsyncScript(String script, Object... args) Execute a script, asynchronously.executeScript(String script, Object... args) Execute a script, synchronously.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 list of elements with filters.find(String selector, SearchFilter... filters) Find list of elements with CSS selector and filters.Wrap 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.frame()Select a frame using this element.io.appium.java_client.AppiumDriverGet the actual underlying AppiumDriver.org.openqa.selenium.Cookiereturn the corresponding cookie given a nameSet<org.openqa.selenium.Cookie>return the cookies as a setorg.openqa.selenium.WebDriverGet the actual underlying Selenium WebDriver.org.openqa.selenium.WebElementreturn the webElementgetLabel()org.openqa.selenium.WebElementvoidOpen the url page<P extends FluentPage>
PgoTo(P page) Open the page, using the url defined in the pagevoidgoToInNewTab(String url) Open the url page in a new tabHovers the mouse over the current element.html()Get the HTML of a the elementid()return the id of the elementsInject object with FluentLenium resources.injectComponent(Object componentContainer, Object parentContainer, org.openqa.selenium.SearchContext context) Inject object with FluentLenium resources, using given search context and parent container.booleanisComponentClass(Class<?> componentClass) Check if this class is a component class.booleanisComponentListClass(Class<? extends List<?>> componentListClass) Check if this class is a component list class.keyboard()Execute keyboard actions on the elementbooleanloaded()Check if the element is loaded.modifyAttribute(String attributeName, String attributeValue) Modifies element attributesmouse()Execute mouse actions on the elementname()return the name of the element<T> TnewComponent(Class<T> componentClass, org.openqa.selenium.WebElement element) Create and register a new component of the provided type from the givenWebElement.<L extends List<T>,T>
LnewComponentList(Class<L> listClass, Class<T> componentClass) Create and register an empty list of component.<L extends List<T>,T>
LnewComponentList(Class<L> listClass, Class<T> componentClass, List<T> componentsList) Create and register a new list of component from the given component list.<L extends List<T>,T>
LnewComponentList(Class<L> listClass, Class<T> componentClass, T... componentsList) Create and register a new list of component from the given component list.<T> ComponentList<T>newComponentList(Class<T> componentClass) Create and register an empty list of component.<T> ComponentList<T>newComponentList(Class<T> componentClass, List<T> componentsList) Create and register a new list of component from the given component list.<T> ComponentList<T>newComponentList(Class<T> componentClass, T... componentsList) Create and register a new list of component from the given component list.newFluent(org.openqa.selenium.WebElement element) Create and register a newFluentWebElementfrom the givenWebElement.Create and register an empty fluent list.newFluentList(FluentWebElement... elements) Create and register a new fluent list from the argument FluentWebElements.<T extends FluentWebElement>
FluentList<T>newFluentList(Class<T> componentClass) Create and register an empty fluent list of the provided type.<T extends FluentWebElement>
FluentList<T>newFluentList(Class<T> componentClass, List<T> elements) Create and register a new fluent list.<T extends FluentWebElement>
FluentList<T>newFluentList(Class<T> componentClass, T... elements) Create and register a new fluent list.newFluentList(List<FluentWebElement> elements) Create and register a new fluent list from the argument list of FluentWebElements.<T> TnewInstance(Class<T> cls) Creates a new instance of a class inject it.noHook()Disable all hooks from actual element.noHook(Class<? extends FluentHook>... hooks) Disable given hook from actual element.<R> RnoHook(Class<? extends FluentHook> hook, Function<FluentWebElement, R> function) Invoke a function with no hook.<R> RnoHook(Function<FluentWebElement, 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.optional()Builds an optional.Return the source of the pagebooleanpresent()Check if the element is present in the DOM.reset()Reset the element.Retore hooks that were defined initially.Scrolls the current element into the visible area of the browser window.scrollIntoView(boolean alignWithTop) Scrolls the current element into the visible area of the browser window.Scrolls center of the current element into the visible area of the browser window, respecting window size.booleanselected()return true if the element is selected, other way falseorg.openqa.selenium.Dimensionsize()return the size of the elementbooleanstale()Check that this element is no longer attached to the DOM.submit()Submit the elementvoidswitchTo()Switch to the default elementvoidswitchTo(FluentList<? extends FluentWebElement> elements) Switch to the first selected Element (if element is null or not an iframe, or doesn't have an id then switch to the default)voidswitchTo(FluentWebElement element) Switch to the selected Element (if element is null or not an iframe, or doesn't have an id then switch to the default)voidSwitch to the default elementtagName()return the tag namevoidTake a html dump of the browser DOM.voidtakeHtmlDump(String fileName) Take a html dump of the browser DOM into a file given by the fileName param.Take a snapshot of the browser.takeScreenshot(String fileName) Take a snapshot of the browser into a file given by the fileName param.text()return the visible text of the elementreturn the text content of the element (even invisible through textContent attribute)toString()voidurl()Return the url of the page.value()return the value of the elementsHelper 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 itwindow()Exposes methods on browser window<O,H extends FluentHook<O>>
FluentWebElementEnable a hook with default options.<O,H extends FluentHook<O>>
FluentWebElementEnable 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.Set the text element
-
Constructor Details
-
FluentWebElement
public FluentWebElement(org.openqa.selenium.WebElement element, FluentControl control, ComponentInstantiator instantiator) Creates a new fluent web element.- Parameters:
element- underlying elementcontrol- control interfaceinstantiator- component instantiator
-
FluentWebElement
public FluentWebElement(org.openqa.selenium.WebElement element, FluentControl control, ComponentInstantiator instantiator, org.openqa.selenium.interactions.Actions actions) Creates a new fluent web element.- Parameters:
element- underlying elementcontrol- control interfaceinstantiator- component instantiator
-
-
Method Details
-
getFluentControl
-
unshadowAllFields
public void unshadowAllFields() -
getLabel
-
executeScript
Description copied from interface:JavascriptControlExecute a script, synchronously.- Specified by:
executeScriptin interfaceJavascriptControl- Parameters:
script- script source to executeargs- script arguments- Returns:
- an object wrapping the result
-
executeAsyncScript
Description copied from interface:JavascriptControlExecute a script, asynchronously.- Specified by:
executeAsyncScriptin interfaceJavascriptControl- Parameters:
script- script source to executeargs- script arguments- Returns:
- an object wrapping the result
-
alert
Description copied from interface:AlertControlGet an object to control the alert window.- Specified by:
alertin interfaceAlertControl- Returns:
- an alert object
-
takeHtmlDump
public void takeHtmlDump()Description copied from interface:SnapshotControlTake a html dump of the browser DOM. By default the file will be a html named by the current timestamp.- Specified by:
takeHtmlDumpin interfaceSnapshotControl
-
takeHtmlDump
Description copied from interface:SnapshotControlTake a html dump of the browser DOM into a file given by the fileName param.- Specified by:
takeHtmlDumpin interfaceSnapshotControl- Parameters:
fileName- file name for html dump
-
canTakeScreenShot
public boolean canTakeScreenShot()Description copied from interface:SnapshotControlCheck if underlyingWebDrivercan take screenshot.- Specified by:
canTakeScreenShotin interfaceSnapshotControl- Returns:
- true if screenshot can be taken, false otherwise
-
takeScreenshot
Description copied from interface:SnapshotControlTake a snapshot of the browser. By default the file will be a png named by the current timestamp.- Specified by:
takeScreenshotin interfaceSnapshotControl- Returns:
- the screenshot file
-
takeScreenshot
Description copied from interface:SnapshotControlTake a snapshot of the browser into a file given by the fileName param.- Specified by:
takeScreenshotin interfaceSnapshotControl- Parameters:
fileName- file name for screenshot- Returns:
- the screenshot file
-
events
Description copied from interface:EventsControlRetrieves an event registry to register event listeners.- Specified by:
eventsin interfaceEventsControl- Returns:
- the event registry.
-
goTo
Description copied from interface:NavigationControlOpen the page, using the url defined in the page- Specified by:
goToin interfaceNavigationControl- Type Parameters:
P- Type of FluentPage- Parameters:
page- page to open- Returns:
- Opened page.
- See Also:
-
goTo
Description copied from interface:NavigationControlOpen the url page- Specified by:
goToin interfaceNavigationControl- Parameters:
url- page URL to visit
-
goToInNewTab
Description copied from interface:NavigationControlOpen the url page in a new tab- Specified by:
goToInNewTabin interfaceNavigationControl- Parameters:
url- the url of the page
-
switchTo
Description copied from interface:NavigationControlSwitch to the first selected Element (if element is null or not an iframe, or doesn't have an id then switch to the default)- Specified by:
switchToin interfaceNavigationControl- Parameters:
elements- fluent list of fluent web elements
-
switchTo
Description copied from interface:NavigationControlSwitch to the selected Element (if element is null or not an iframe, or doesn't have an id then switch to the default)- Specified by:
switchToin interfaceNavigationControl- Parameters:
element- fluent web element to switch to
-
switchTo
public void switchTo()Description copied from interface:NavigationControlSwitch to the default element- Specified by:
switchToin interfaceNavigationControl
-
switchToDefault
public void switchToDefault()Description copied from interface:NavigationControlSwitch to the default element- Specified by:
switchToDefaultin interfaceNavigationControl
-
pageSource
Description copied from interface:NavigationControlReturn the source of the page- Specified by:
pageSourcein interfaceNavigationControl- Returns:
- source of the page under test
-
window
Description copied from interface:NavigationControlExposes methods on browser window- Specified by:
windowin interfaceNavigationControl- Returns:
- Window actions
-
getCookies
Description copied from interface:NavigationControlreturn the cookies as a set- Specified by:
getCookiesin interfaceNavigationControl- Returns:
- set of cookies
-
getCookie
Description copied from interface:NavigationControlreturn the corresponding cookie given a name- Specified by:
getCookiein interfaceNavigationControl- Parameters:
name- cookie name- Returns:
- cookie selected by name
-
url
Description copied from interface:NavigationControlReturn the url of the page. If a base url is provided, the current url will be relative to that base url.- Specified by:
urlin interfaceNavigationControl- Returns:
- current URL
-
getDriver
public org.openqa.selenium.WebDriver getDriver()Description copied from interface:SeleniumDriverControlGet the actual underlying Selenium WebDriver.To customize the WebDriver, you should configure
FluentControl.getWebDriver()or overrideIFluentAdapter.newWebDriver().This method can't be overridden to customize the WebDriver.
- Specified by:
getDriverin interfaceSeleniumDriverControl- Returns:
- The actual underlying Selenium WebDriver
-
getAppiumDriver
public io.appium.java_client.AppiumDriver getAppiumDriver()Description copied from interface:SeleniumDriverControlGet the actual underlying AppiumDriver.To customize the WebDriver, you should configure
FluentControl.getWebDriver()or overrideIFluentAdapter.newWebDriver().This method can't be overridden to customize the AppiumDriver.
- Specified by:
getAppiumDriverin interfaceSeleniumDriverControl- Returns:
- The actual underlying AppiumDriver
-
css
Description copied from interface:CssControlFeatures related to CSS loaded in the active page.- Specified by:
cssin interfaceCssControl- Returns:
- a CssSupport instance
-
inject
Description copied from interface:FluentInjectControlInject object with FluentLenium resources.- Specified by:
injectin interfaceFluentInjectControl- Parameters:
container- container to inject with FluentLenium resources- Returns:
- The container context related to the injected container
-
injectComponent
public ContainerContext injectComponent(Object componentContainer, Object parentContainer, org.openqa.selenium.SearchContext context) Description copied from interface:FluentInjectControlInject object with FluentLenium resources, using given search context and parent container.- Specified by:
injectComponentin interfaceFluentInjectControl- Parameters:
componentContainer- container to inject with FluentLenium resourcesparentContainer- parent containercontext- search context to use for injection- Returns:
- The container context related to the injected container
-
newInstance
Description copied from interface:FluentInjectControlCreates a new instance of a class inject it.- Specified by:
newInstancein interfaceFluentInjectControl- Type Parameters:
T- type of the object- Parameters:
cls- class of the object to create- Returns:
- new container instance
- See Also:
-
newFluent
Description copied from interface:ComponentInstantiatorCreate and register a newFluentWebElementfrom the givenWebElement.- Specified by:
newFluentin interfaceComponentInstantiator- Parameters:
element- wrapped element- Returns:
- new instance of the component
-
newComponent
Description copied from interface:ComponentInstantiatorCreate and register a new component of the provided type from the givenWebElement.- Specified by:
newComponentin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentelement- wrapped element- Returns:
- new instance of the component
-
newFluentList
Description copied from interface:ComponentInstantiatorCreate and register an empty fluent list.- Specified by:
newFluentListin interfaceComponentInstantiator- Returns:
- new list of fluent web element
-
newFluentList
Description copied from interface:ComponentInstantiatorCreate and register a new fluent list from the argument FluentWebElements.- Specified by:
newFluentListin interfaceComponentInstantiator- Parameters:
elements- list of elements- Returns:
- new list of fluent web element
-
newFluentList
Description copied from interface:ComponentInstantiatorCreate and register a new fluent list from the argument list of FluentWebElements.- Specified by:
newFluentListin interfaceComponentInstantiator- Parameters:
elements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
Description copied from interface:ComponentInstantiatorCreate and register a new fluent list from the argument WebElements.- Specified by:
asFluentListin interfaceComponentInstantiator- Parameters:
elements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
Description copied from interface:ComponentInstantiatorCreate and register a new fluent list from the argument collection of WebElements.- Specified by:
asFluentListin interfaceComponentInstantiator- Parameters:
elements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
Description copied from interface:ComponentInstantiatorCreate and register a new fluent list from the argument list of WebElements.- Specified by:
asFluentListin interfaceComponentInstantiator- Parameters:
elements- list of elements- Returns:
- new list of fluent web element
-
newFluentList
Description copied from interface:ComponentInstantiatorCreate and register an empty fluent list of the provided type.- Specified by:
newFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the component- Returns:
- new list of fluent web element
-
newFluentList
public <T extends FluentWebElement> FluentList<T> newFluentList(Class<T> componentClass, T... elements) Description copied from interface:ComponentInstantiatorCreate and register a new fluent list.- Specified by:
newFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the componentelements- list of elements- Returns:
- new list of fluent web element
-
newFluentList
public <T extends FluentWebElement> FluentList<T> newFluentList(Class<T> componentClass, List<T> elements) Description copied from interface:ComponentInstantiatorCreate and register a new fluent list.- Specified by:
newFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the componentelements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(Class<T> componentClass, org.openqa.selenium.WebElement... elements) Description copied from interface:ComponentInstantiatorCreate and register a new fluent list.- Specified by:
asFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the componentelements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new fluent list.- Specified by:
asFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the componentelements- list of elements- Returns:
- new list of fluent web element
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new fluent list.- Specified by:
asFluentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- class of the componentelements- list of elements- Returns:
- new list of fluent web element
-
newComponentList
Description copied from interface:ComponentInstantiatorCreate and register an empty list of component.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the component- Returns:
- new list of components
-
asComponentList
public <T> ComponentList<T> asComponentList(Class<T> componentClass, org.openqa.selenium.WebElement... elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentelements- elements- Returns:
- new list of components
-
asComponentList
public <T> ComponentList asComponentList(Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentelements- elements- Returns:
- new list of components
-
asComponentList
public <T> ComponentList<T> asComponentList(Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentelements- elements- Returns:
- new list of components
-
newComponentList
Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given component list.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentcomponentsList- components list- Returns:
- new list of components
-
newComponentList
Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given component list.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
T- type of the component- Parameters:
componentClass- type of the componentcomponentsList- components list- Returns:
- new list of components
-
newComponentList
Description copied from interface:ComponentInstantiatorCreate and register an empty list of component.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the component- Returns:
- new list of components
-
asComponentList
public <L extends List<T>,T> L asComponentList(Class<L> listClass, Class<T> componentClass, org.openqa.selenium.WebElement... elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentelements- elements- Returns:
- new list of components
-
asComponentList
public <L extends List<T>,T> L asComponentList(Class<L> listClass, Class<T> componentClass, Iterable<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentelements- elements- Returns:
- new list of components
-
asComponentList
public <L extends List<T>,T> L asComponentList(Class<L> listClass, Class<T> componentClass, List<org.openqa.selenium.WebElement> elements) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given element iterable.- Specified by:
asComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentelements- elements- Returns:
- new list of components
-
newComponentList
public <L extends List<T>,T> L newComponentList(Class<L> listClass, Class<T> componentClass, T... componentsList) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given component list.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentcomponentsList- components list- Returns:
- new list of components
-
newComponentList
public <L extends List<T>,T> L newComponentList(Class<L> listClass, Class<T> componentClass, List<T> componentsList) Description copied from interface:ComponentInstantiatorCreate and register a new list of component from the given component list.- Specified by:
newComponentListin interfaceComponentInstantiator- Type Parameters:
L- type of the listT- type of the component- Parameters:
listClass- type of the listcomponentClass- type of the componentcomponentsList- components list- Returns:
- new list of components
-
isComponentClass
Description copied from interface:ComponentInstantiatorCheck if this class is a component class.- Specified by:
isComponentClassin interfaceComponentInstantiator- Parameters:
componentClass- class to check- Returns:
- true if this class is a component class, false otherwise
-
isComponentListClass
Description copied from interface:ComponentInstantiatorCheck if this class is a component list class.- Specified by:
isComponentListClassin interfaceComponentInstantiator- Parameters:
componentListClass- class to check- Returns:
- true if this class is a component list class, false otherwise
-
capabilities
public org.openqa.selenium.Capabilities capabilities()Description copied from interface:CapabilitiesControlGet the actual capabilities of the underlying Selenium WebDriver.- Specified by:
capabilitiesin interfaceCapabilitiesControl- Returns:
- actual capabilities.
- See Also:
-
click
Description copied from interface:FluentActionsPerform a click.- Specified by:
clickin interfaceFluentActions<FluentWebElement,FluentWebElement> - Returns:
- this object reference to chain methods calls
- See Also:
-
doubleClick
Description copied from interface:FluentActionsPerform a double click.- Specified by:
doubleClickin interfaceFluentActions<FluentWebElement,FluentWebElement> - Returns:
- this object reference to chain methods calls
-
contextClick
Description copied from interface:FluentActionsPerform a context click.- Specified by:
contextClickin interfaceFluentActions<FluentWebElement,FluentWebElement> - Returns:
- this object reference to chain methods 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<FluentWebElement,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<FluentWebElement,FluentWebElement> - Parameters:
duration- - enabled to override default 5 seconds of waiting- Returns:
- this object reference to chain methods calls
-
hoverOver
Description copied from interface:FluentActionsHovers the mouse over the current element.By default, this is a convenience method for calling
element.mouse().moveToElement().- Specified by:
hoverOverin interfaceFluentActions<FluentWebElement,FluentWebElement> - Returns:
- the current element
-
present
public boolean present()Description copied from interface:FluentProxyStateCheck if the element is present in the DOM.- Specified by:
presentin interfaceFluentProxyState<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<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<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<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<FluentWebElement>- Returns:
- true if the element is loaded, false otherwise
-
axes
Deprecated.Usedom()instead.XPath Axes accessor (parent, ancestors, preceding, following, ...).- Returns:
- object to perform XPath Axes transformations.
-
dom
XPath Axes accessor (parent, ancestors, preceding, following, ...).- Returns:
- object to perform XPath Axes transformations.
-
conditions
Get a conditions object used to verify condition on this element.- Returns:
- conditions object
-
await
Build a wait object to wait for a condition of this element.- Returns:
- a wait object
-
mouse
Execute mouse actions on the element- Returns:
- mouse actions object
-
keyboard
Execute keyboard actions on the element- Returns:
- keyboard actions object
-
as
Wrap all underlying elements in a component.- Type Parameters:
T- type of component- Parameters:
componentClass- component class- Returns:
- element as component.
-
clear
Clear the element- Returns:
- fluent web element
-
clearReactInput
Clear React input using Backspace only- Returns:
- fluent web element
-
submit
Submit the element- Specified by:
submitin interfaceFluentActions<FluentWebElement,FluentWebElement> - Returns:
- fluent web element
- See Also:
-
write
Set the text element- Specified by:
writein interfaceFluentActions<FluentWebElement,FluentWebElement> - Parameters:
text- value to set- Returns:
- fluent web element
- See Also:
-
name
return the name of the element- Returns:
- name of the element
-
attribute
return any value of custom attribute (generated=true will return "true" if attribute("generated") is called.- Parameters:
name- custom attribute name- Returns:
- name value
- See Also:
-
cssValue
Get the value of a given CSS property.- Parameters:
propertyName- the css property name of the element- Returns:
- The current, computed value of the property.
- See Also:
-
id
return the id of the elements- Returns:
- id of element
-
text
return the visible text of the element- Returns:
- text of element
- See Also:
-
textContent
return the text content of the element (even invisible through textContent attribute)- Returns:
- text content of element
-
value
return the value of the elements- Returns:
- value of attribute
-
displayed
public boolean displayed()return true if the element is displayed, other way return false- Returns:
- boolean value of displayed check
- See Also:
-
enabled
public boolean enabled()return true if the element is enabled, other way return false- Returns:
- boolean value of enabled check
- See Also:
-
selected
public boolean selected()return true if the element is selected, other way false- Returns:
- boolean value of selected check
- See Also:
-
clickable
public boolean clickable()Check that this element is visible and enabled such that you can click it.- Returns:
- true if the element can be clicked, false otherwise.
-
stale
public boolean stale()Check that this element is no longer attached to the DOM.- Returns:
- false is the element is still attached to the DOM, true otherwise.
-
tagName
return the tag name- Returns:
- string value of tag name
- See Also:
-
getElement
public org.openqa.selenium.WebElement getElement()return the webElement- Returns:
- web element
-
getWrappedElement
public org.openqa.selenium.WebElement getWrappedElement()- Specified by:
getWrappedElementin interfaceorg.openqa.selenium.WrapsElement
-
size
public org.openqa.selenium.Dimension size()return the size of the element- Returns:
- dimension/size of element
- See Also:
-
asList
Converts this element as a single element list.- Returns:
- list of element
-
find
Description copied from interface:SearchControlFind list of elements with Selenium locator and filters.- Specified by:
findin interfaceSearchControl<FluentWebElement>- Parameters:
locator- elements locatorfilters- filters set- Returns:
- list of elements
-
find
Description copied from interface:SearchControlFind list of elements with CSS selector and filters.- Specified by:
findin interfaceSearchControl<FluentWebElement>- Parameters:
selector- CSS selectorfilters- set of filters- Returns:
- list of element
-
find
Description copied from interface:SearchControlFind list of elements with filters.- Specified by:
findin interfaceSearchControl<FluentWebElement>- Parameters:
filters- set of filters in the current context- Returns:
- list of elements
-
find
Description copied from interface:SearchControlWrap raw selenium elements into a list of elements.- Specified by:
findin interfaceSearchControl<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<FluentWebElement>- Parameters:
rawElement- raw selenium element- Returns:
- element
-
html
Get the HTML of a the element- Returns:
- the underlying html content
-
fill
Description copied from interface:FluentActionsConstruct a Fill Builder in order to allow easy fill of visible input fields.- Specified by:
fillin interfaceFluentActions<FluentWebElement,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<FluentWebElement,FluentWebElement> - Returns:
- Fill select builder
-
frame
Description copied from interface:FluentActionsSelect a frame using this element.- Specified by:
framein interfaceFluentActions<FluentWebElement,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<FluentWebElement>- Returns:
- An optional wrapping this.
- See Also:
-
toString
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<FluentWebElement>- Type Parameters:
R- return type- Parameters:
hook- hook class to disablefunction- function to invoke- Returns:
- return value of the given function
-
withHook
Description copied from interface:HookControlEnable a hook with given options.- Specified by:
withHookin interfaceHookControl<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
-
withHook
Description copied from interface:HookControlEnable a hook with default options.- Specified by:
withHookin interfaceHookControl<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:HookControlDisable given hook from actual element.- Specified by:
noHookin interfaceHookControl<FluentWebElement>- Parameters:
hooks- hook classes to disable- Returns:
- this object reference to chain calls
-
noHook
Description copied from interface:HookControlInvoke a function with no hook.- Specified by:
noHookin interfaceHookControl<FluentWebElement>- Type Parameters:
R- return type- Parameters:
function- function to invoke- Returns:
- return value of the given function
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with given hook disabled.- Specified by:
noHookInstancein interfaceHookControl<FluentWebElement>- Parameters:
hooks- hook classes to disable- Returns:
- new element locator with hook disabled.
-
restoreHooks
Description copied from interface:HookControlRetore hooks that were defined initially.- Specified by:
restoreHooksin interfaceHookControl<FluentWebElement>- Returns:
- this object reference to chain calls
-
noHookInstance
Description copied from interface:HookControlCreates a new element locator instance with all hooks disabled.- Specified by:
noHookInstancein interfaceHookControl<FluentWebElement>- Returns:
- new element locator with hook disabled.
-
noHook
Description copied from interface:HookControlDisable all hooks from actual element.- Specified by:
noHookin interfaceHookControl<FluentWebElement>- Returns:
- this object reference to chain calls
-
scrollToCenter
Description copied from interface:FluentJavascriptActionsScrolls center of the current element into the visible area of the browser window, respecting window size.- Specified by:
scrollToCenterin interfaceFluentJavascriptActions- Returns:
- this object reference to chain methods calls
-
scrollIntoView
Description copied from interface:FluentJavascriptActionsScrolls the current element into the visible area of the browser window.- Specified by:
scrollIntoViewin interfaceFluentJavascriptActions- Returns:
- this object reference to chain methods calls
- See Also:
-
scrollIntoView
Description copied from interface:FluentJavascriptActionsScrolls the current element into the visible area of the browser window.- Specified by:
scrollIntoViewin interfaceFluentJavascriptActions- 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
Description copied from interface:FluentJavascriptActionsModifies element attributes- Specified by:
modifyAttributein interfaceFluentJavascriptActions- Parameters:
attributeName- attribute to be changeattributeValue- new attribute value- Returns:
- this object reference to chain methods 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<FluentWebElement>- Parameters:
labelHint- label hints to add- Returns:
- reference to this object to chain calls
-
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<FluentWebElement>- Parameters:
label- label to use- Returns:
- reference to this object to chain calls
-
dom()instead.