Package org.fluentlenium.core.domain
Class FluentWebElement
- java.lang.Object
-
- org.fluentlenium.core.domain.Component
-
- org.fluentlenium.core.domain.FluentWebElement
-
- All Implemented Interfaces:
FluentActions<FluentWebElement,FluentWebElement>
,FluentJavascriptActions
,HookControl<FluentWebElement>
,FluentLabel<FluentWebElement>
,FluentProxyState<FluentWebElement>
,SearchControl<FluentWebElement>
,org.openqa.selenium.internal.WrapsElement
,org.openqa.selenium.WrapsElement
public class FluentWebElement extends Component implements org.openqa.selenium.internal.WrapsElement, FluentActions<FluentWebElement,FluentWebElement>, FluentProxyState<FluentWebElement>, SearchControl<FluentWebElement>, HookControl<FluentWebElement>, FluentLabel<FluentWebElement>
Wraps a SeleniumWebElement
. It provides an enhanced API to control selenium element.
-
-
Field Summary
-
Fields inherited from class org.fluentlenium.core.domain.Component
control, instantiator, webElement
-
-
Constructor Summary
Constructors Constructor Description FluentWebElement(org.openqa.selenium.WebElement element, FluentControl control, ComponentInstantiator instantiator)
Creates a new fluent web element.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FluentList<FluentWebElement>
$(java.util.List<org.openqa.selenium.WebElement> rawElements)
Wrap raw selenium elements into a list of elements.org.openqa.selenium.Alert
alert()
<T> T
as(java.lang.Class<T> componentClass)
Wrap all underlying elements in a component.<L extends java.util.List<T>,T>
LasComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
<L extends java.util.List<T>,T>
LasComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
<L extends java.util.List<T>,T>
LasComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
<T> ComponentList
asComponentList(java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
<T> ComponentList<T>
asComponentList(java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
<T> ComponentList<T>
asComponentList(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
<T extends FluentWebElement>
FluentList<T>asFluentList(java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
<T extends FluentWebElement>
FluentList<T>asFluentList(java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
<T extends FluentWebElement>
FluentList<T>asFluentList(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
FluentList<FluentWebElement>
asFluentList(java.lang.Iterable<org.openqa.selenium.WebElement> elements)
FluentList<FluentWebElement>
asFluentList(java.util.List<org.openqa.selenium.WebElement> elements)
FluentList<FluentWebElement>
asFluentList(org.openqa.selenium.WebElement... elements)
FluentList<FluentWebElement>
asList()
Converts this element as a single element list.java.lang.String
attribute(java.lang.String name)
return any value of custom attribute (generated=true will return "true" if attribute("generated") is called.FluentWaitElement
await()
Build a wait object to wait for a condition of this element.Dom
axes()
Deprecated.Usedom()
instead.boolean
canTakeScreenShot()
org.openqa.selenium.Capabilities
capabilities()
FluentWebElement
clear()
Clear the elementFluentWebElement
clearReactInput()
Clear React input using Backspace onlyFluentWebElement
click()
Perform a click.boolean
clickable()
Check that this element is visible and enabled such that you can click it.FluentConditions
conditions()
Get a conditions object used to verify condition on this element.FluentWebElement
contextClick()
Perform a context click.CssSupport
css()
java.lang.String
cssValue(java.lang.String propertyName)
Get the value of a given CSS property.boolean
displayed()
return true if the element is displayed, other way return falseDom
dom()
XPath Axes accessor (parent, ancestors, preceding, following, ...).FluentWebElement
doubleClick()
Perform a double click.FluentWebElement
el(org.openqa.selenium.WebElement rawElement)
Wrap existing raw selenium element into an element.boolean
enabled()
return true if the element is enabled, other way return falseEventsRegistry
events()
FluentJavascript
executeAsyncScript(java.lang.String script, java.lang.Object... args)
FluentJavascript
executeScript(java.lang.String script, java.lang.Object... args)
Fill
fill()
Construct a Fill Builder in order to allow easy fill of visible input fields.FillSelect
fillSelect()
Construct a Fill Select Builder in order to allow easy fill of visible input fields.FluentList<FluentWebElement>
find(java.lang.String selector, SearchFilter... filters)
Find list of elements with CSS selector and filters.FluentList<FluentWebElement>
find(java.util.List<org.openqa.selenium.WebElement> rawElements)
Wrap raw selenium elements into a list of elements.FluentList<FluentWebElement>
find(SearchFilter... filters)
Find list of elements with filters.FluentList<FluentWebElement>
find(org.openqa.selenium.By locator, SearchFilter... filters)
Find list of elements with Selenium locator and filters.FluentWebElement
frame()
Select a frame using this element.java.lang.Long
getAwaitAtMost()
java.lang.Long
getAwaitPollingEvery()
java.lang.String
getBaseUrl()
java.lang.Long
getBrowserTimeout()
java.lang.Integer
getBrowserTimeoutRetries()
org.openqa.selenium.Capabilities
getCapabilities()
java.lang.Class<? extends ConfigurationProperties>
getConfigurationDefaults()
java.lang.Class<? extends ConfigurationFactory>
getConfigurationFactory()
org.openqa.selenium.Cookie
getCookie(java.lang.String name)
java.util.Set<org.openqa.selenium.Cookie>
getCookies()
java.lang.String
getCustomProperty(java.lang.String propertyName)
java.lang.Boolean
getDeleteCookies()
org.openqa.selenium.WebDriver
getDriver()
ConfigurationProperties.DriverLifecycle
getDriverLifecycle()
org.openqa.selenium.WebElement
getElement()
return the webElementjava.lang.Boolean
getEventsEnabled()
ConfigurationProperties.TriggerMode
getHtmlDumpMode()
java.lang.String
getHtmlDumpPath()
java.lang.Long
getImplicitlyWait()
FluentLabel<FluentWebElement>
getLabel()
java.lang.Long
getPageLoadTimeout()
java.lang.String
getRemoteUrl()
ConfigurationProperties.TriggerMode
getScreenshotMode()
java.lang.String
getScreenshotPath()
java.lang.Long
getScriptTimeout()
java.lang.String
getWebDriver()
org.openqa.selenium.WebElement
getWrappedElement()
void
goTo(java.lang.String url)
<P extends FluentPage>
PgoTo(P page)
void
goToInNewTab(java.lang.String url)
java.lang.String
html()
Get the HTML of a the elementjava.lang.String
id()
return the id of the elementsContainerContext
inject(java.lang.Object container)
ContainerContext
injectComponent(java.lang.Object componentContainer, java.lang.Object parentContainer, org.openqa.selenium.SearchContext context)
boolean
isComponentClass(java.lang.Class<?> componentClass)
boolean
isComponentListClass(java.lang.Class<? extends java.util.List<?>> componentListClass)
KeyboardElementActions
keyboard()
Execute keyboard actions on the elementboolean
loaded()
Check if the element is loaded.FluentWebElement
modifyAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Modifies element attributesMouseElementActions
mouse()
Execute mouse actions on the elementjava.lang.String
name()
return the name of the element<T> T
newComponent(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement element)
<L extends java.util.List<T>,T>
LnewComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass)
<L extends java.util.List<T>,T>
LnewComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.util.List<T> componentsList)
<L extends java.util.List<T>,T>
LnewComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, T... componentsList)
<T> ComponentList<T>
newComponentList(java.lang.Class<T> componentClass)
<T> ComponentList<T>
newComponentList(java.lang.Class<T> componentClass, java.util.List<T> componentsList)
<T> ComponentList<T>
newComponentList(java.lang.Class<T> componentClass, T... componentsList)
FluentWebElement
newFluent(org.openqa.selenium.WebElement element)
FluentList<FluentWebElement>
newFluentList()
<T extends FluentWebElement>
FluentList<T>newFluentList(java.lang.Class<T> componentClass)
<T extends FluentWebElement>
FluentList<T>newFluentList(java.lang.Class<T> componentClass, java.util.List<T> elements)
<T extends FluentWebElement>
FluentList<T>newFluentList(java.lang.Class<T> componentClass, T... elements)
FluentList<FluentWebElement>
newFluentList(java.util.List<FluentWebElement> elements)
FluentList<FluentWebElement>
newFluentList(FluentWebElement... elements)
<T> T
newInstance(java.lang.Class<T> cls)
FluentWebElement
noHook()
Disable all hooks from actual element.FluentWebElement
noHook(java.lang.Class<? extends FluentHook>... hooks)
Disable given hook from actual element.<R> R
noHook(java.lang.Class<? extends FluentHook> hook, java.util.function.Function<FluentWebElement,R> function)
Invoke a function with no hook.<R> R
noHook(java.util.function.Function<FluentWebElement,R> function)
Invoke a function with no hook.FluentWebElement
noHookInstance()
Creates a new element locator instance with all hooks disabled.FluentWebElement
noHookInstance(java.lang.Class<? extends FluentHook>... hooks)
Creates a new element locator instance with given hook disabled.FluentWebElement
now()
Search for the element now, actually performing the search on theWebDriver
.FluentWebElement
now(boolean force)
Search for the element now, actually performing the search on theWebDriver
.java.util.Optional<FluentWebElement>
optional()
Builds an optional.java.lang.String
pageSource()
boolean
present()
Check if the element is present in the DOM.FluentWebElement
reset()
Reset the element.FluentWebElement
restoreHooks()
Retore hooks that were defined initially.FluentWebElement
scrollIntoView()
Scrolls the current element into the visible area of the browser window.FluentWebElement
scrollIntoView(boolean alignWithTop)
Scrolls the current element into the visible area of the browser window.FluentWebElement
scrollToCenter()
Scrolls center of the current element into the visible area of the browser window, respecting window size.boolean
selected()
return true if the element is selected, other way falsevoid
setAwaitAtMost(java.lang.Long awaitAtMost)
void
setAwaitPollingEvery(java.lang.Long awaitPollingEvery)
void
setBaseUrl(java.lang.String baseUrl)
void
setBrowserTimeout(java.lang.Long timeout)
void
setBrowserTimeoutRetries(java.lang.Integer retriesNumber)
void
setCapabilities(org.openqa.selenium.Capabilities capabilities)
void
setConfigurationFactory(java.lang.Class<? extends ConfigurationFactory> configurationFactory)
void
setCustomProperty(java.lang.String key, java.lang.String value)
void
setDeleteCookies(java.lang.Boolean deleteCookies)
void
setDriverLifecycle(ConfigurationProperties.DriverLifecycle driverLifecycle)
void
setEventsEnabled(java.lang.Boolean eventsEnabled)
void
setHtmlDumpMode(ConfigurationProperties.TriggerMode htmlDumpMode)
void
setHtmlDumpPath(java.lang.String htmlDumpPath)
void
setImplicitlyWait(java.lang.Long implicitlyWait)
void
setPageLoadTimeout(java.lang.Long pageLoadTimeout)
void
setRemoteUrl(java.lang.String remoteUrl)
void
setScreenshotMode(ConfigurationProperties.TriggerMode screenshotMode)
void
setScreenshotPath(java.lang.String screenshotPath)
void
setScriptTimeout(java.lang.Long scriptTimeout)
void
setWebDriver(java.lang.String webDriver)
org.openqa.selenium.Dimension
size()
return the size of the elementboolean
stale()
Check that this element is no longer attached to the DOM.FluentWebElement
submit()
Submit the elementvoid
switchTo()
void
switchTo(FluentList<? extends FluentWebElement> elements)
void
switchTo(FluentWebElement element)
void
switchToDefault()
java.lang.String
tagName()
return the tag namevoid
takeHtmlDump()
void
takeHtmlDump(java.lang.String fileName)
void
takeScreenshot()
void
takeScreenshot(java.lang.String fileName)
java.lang.String
text()
return the visible text of the elementjava.lang.String
textContent()
return the text content of the element (even invisible through textContent attribute)java.lang.String
toString()
java.lang.String
url()
java.lang.String
value()
return the value of the elementsWindowAction
window()
<O,H extends FluentHook<O>>
FluentWebElementwithHook(java.lang.Class<H> hook)
Enable a hook with default options.<O,H extends FluentHook<O>>
FluentWebElementwithHook(java.lang.Class<H> hook, O options)
Enable a hook with given options.FluentWebElement
withLabel(java.lang.String label)
Apply a label that will be displayed as the representation of this object for error message.FluentWebElement
withLabelHint(java.lang.String... labelHint)
Add a label hint that will be appended to the representation of this object for error message.FluentWebElement
write(java.lang.String... text)
Set the text element
-
-
-
Constructor Detail
-
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
-
-
Method Detail
-
getLabel
public FluentLabel<FluentWebElement> getLabel()
-
executeScript
public FluentJavascript executeScript(java.lang.String script, java.lang.Object... args)
-
executeAsyncScript
public FluentJavascript executeAsyncScript(java.lang.String script, java.lang.Object... args)
-
alert
public org.openqa.selenium.Alert alert()
-
takeHtmlDump
public void takeHtmlDump()
-
takeHtmlDump
public void takeHtmlDump(java.lang.String fileName)
-
canTakeScreenShot
public boolean canTakeScreenShot()
-
takeScreenshot
public void takeScreenshot()
-
takeScreenshot
public void takeScreenshot(java.lang.String fileName)
-
events
public EventsRegistry events()
-
goTo
public <P extends FluentPage> P goTo(P page)
-
goTo
public void goTo(java.lang.String url)
-
goToInNewTab
public void goToInNewTab(java.lang.String url)
-
switchTo
public void switchTo(FluentList<? extends FluentWebElement> elements)
-
switchTo
public void switchTo(FluentWebElement element)
-
switchTo
public void switchTo()
-
switchToDefault
public void switchToDefault()
-
pageSource
public java.lang.String pageSource()
-
window
public WindowAction window()
-
getCookies
public java.util.Set<org.openqa.selenium.Cookie> getCookies()
-
getCookie
public org.openqa.selenium.Cookie getCookie(java.lang.String name)
-
url
public java.lang.String url()
-
getDriver
public org.openqa.selenium.WebDriver getDriver()
-
css
public CssSupport css()
-
inject
public ContainerContext inject(java.lang.Object container)
-
injectComponent
public ContainerContext injectComponent(java.lang.Object componentContainer, java.lang.Object parentContainer, org.openqa.selenium.SearchContext context)
-
newInstance
public <T> T newInstance(java.lang.Class<T> cls)
-
newFluent
public FluentWebElement newFluent(org.openqa.selenium.WebElement element)
-
newComponent
public <T> T newComponent(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement element)
-
newFluentList
public FluentList<FluentWebElement> newFluentList()
-
newFluentList
public FluentList<FluentWebElement> newFluentList(FluentWebElement... elements)
-
newFluentList
public FluentList<FluentWebElement> newFluentList(java.util.List<FluentWebElement> elements)
-
asFluentList
public FluentList<FluentWebElement> asFluentList(org.openqa.selenium.WebElement... elements)
-
asFluentList
public FluentList<FluentWebElement> asFluentList(java.lang.Iterable<org.openqa.selenium.WebElement> elements)
-
asFluentList
public FluentList<FluentWebElement> asFluentList(java.util.List<org.openqa.selenium.WebElement> elements)
-
newFluentList
public <T extends FluentWebElement> FluentList<T> newFluentList(java.lang.Class<T> componentClass)
-
newFluentList
public <T extends FluentWebElement> FluentList<T> newFluentList(java.lang.Class<T> componentClass, T... elements)
-
newFluentList
public <T extends FluentWebElement> FluentList<T> newFluentList(java.lang.Class<T> componentClass, java.util.List<T> elements)
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
-
asFluentList
public <T extends FluentWebElement> FluentList<T> asFluentList(java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
-
newComponentList
public <T> ComponentList<T> newComponentList(java.lang.Class<T> componentClass)
-
asComponentList
public <T> ComponentList<T> asComponentList(java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
-
asComponentList
public <T> ComponentList asComponentList(java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
-
asComponentList
public <T> ComponentList<T> asComponentList(java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
-
newComponentList
public <T> ComponentList<T> newComponentList(java.lang.Class<T> componentClass, T... componentsList)
-
newComponentList
public <T> ComponentList<T> newComponentList(java.lang.Class<T> componentClass, java.util.List<T> componentsList)
-
newComponentList
public <L extends java.util.List<T>,T> L newComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass)
-
asComponentList
public <L extends java.util.List<T>,T> L asComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, org.openqa.selenium.WebElement... elements)
-
asComponentList
public <L extends java.util.List<T>,T> L asComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.lang.Iterable<org.openqa.selenium.WebElement> elements)
-
asComponentList
public <L extends java.util.List<T>,T> L asComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.util.List<org.openqa.selenium.WebElement> elements)
-
newComponentList
public <L extends java.util.List<T>,T> L newComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, T... componentsList)
-
newComponentList
public <L extends java.util.List<T>,T> L newComponentList(java.lang.Class<L> listClass, java.lang.Class<T> componentClass, java.util.List<T> componentsList)
-
isComponentClass
public boolean isComponentClass(java.lang.Class<?> componentClass)
-
capabilities
public org.openqa.selenium.Capabilities capabilities()
-
isComponentListClass
public boolean isComponentListClass(java.lang.Class<? extends java.util.List<?>> componentListClass)
-
getWebDriver
public java.lang.String getWebDriver()
-
getRemoteUrl
public java.lang.String getRemoteUrl()
-
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()
-
getBaseUrl
public java.lang.String getBaseUrl()
-
getDriverLifecycle
public ConfigurationProperties.DriverLifecycle getDriverLifecycle()
-
getBrowserTimeout
public java.lang.Long getBrowserTimeout()
-
getBrowserTimeoutRetries
public java.lang.Integer getBrowserTimeoutRetries()
-
getDeleteCookies
public java.lang.Boolean getDeleteCookies()
-
getPageLoadTimeout
public java.lang.Long getPageLoadTimeout()
-
getImplicitlyWait
public java.lang.Long getImplicitlyWait()
-
getScriptTimeout
public java.lang.Long getScriptTimeout()
-
getAwaitAtMost
public java.lang.Long getAwaitAtMost()
-
getAwaitPollingEvery
public java.lang.Long getAwaitPollingEvery()
-
getEventsEnabled
public java.lang.Boolean getEventsEnabled()
-
getScreenshotPath
public java.lang.String getScreenshotPath()
-
getScreenshotMode
public ConfigurationProperties.TriggerMode getScreenshotMode()
-
getHtmlDumpPath
public java.lang.String getHtmlDumpPath()
-
getHtmlDumpMode
public ConfigurationProperties.TriggerMode getHtmlDumpMode()
-
getConfigurationDefaults
public java.lang.Class<? extends ConfigurationProperties> getConfigurationDefaults()
-
getConfigurationFactory
public java.lang.Class<? extends ConfigurationFactory> getConfigurationFactory()
-
getCustomProperty
public java.lang.String getCustomProperty(java.lang.String propertyName)
-
setWebDriver
public void setWebDriver(java.lang.String webDriver)
-
setBrowserTimeout
public void setBrowserTimeout(java.lang.Long timeout)
-
setBrowserTimeoutRetries
public void setBrowserTimeoutRetries(java.lang.Integer retriesNumber)
-
setRemoteUrl
public void setRemoteUrl(java.lang.String remoteUrl)
-
setCapabilities
public void setCapabilities(org.openqa.selenium.Capabilities capabilities)
-
setConfigurationFactory
public void setConfigurationFactory(java.lang.Class<? extends ConfigurationFactory> configurationFactory)
-
setDriverLifecycle
public void setDriverLifecycle(ConfigurationProperties.DriverLifecycle driverLifecycle)
-
setDeleteCookies
public void setDeleteCookies(java.lang.Boolean deleteCookies)
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
-
setPageLoadTimeout
public void setPageLoadTimeout(java.lang.Long pageLoadTimeout)
-
setImplicitlyWait
public void setImplicitlyWait(java.lang.Long implicitlyWait)
-
setAwaitAtMost
public void setAwaitAtMost(java.lang.Long awaitAtMost)
-
setAwaitPollingEvery
public void setAwaitPollingEvery(java.lang.Long awaitPollingEvery)
-
setScriptTimeout
public void setScriptTimeout(java.lang.Long scriptTimeout)
-
setEventsEnabled
public void setEventsEnabled(java.lang.Boolean eventsEnabled)
-
setScreenshotPath
public void setScreenshotPath(java.lang.String screenshotPath)
-
setScreenshotMode
public void setScreenshotMode(ConfigurationProperties.TriggerMode screenshotMode)
-
setHtmlDumpPath
public void setHtmlDumpPath(java.lang.String htmlDumpPath)
-
setHtmlDumpMode
public void setHtmlDumpMode(ConfigurationProperties.TriggerMode htmlDumpMode)
-
setCustomProperty
public void setCustomProperty(java.lang.String key, java.lang.String value)
-
click
public FluentWebElement click()
Description copied from interface:FluentActions
Perform a click.- Specified by:
click
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- this object reference to chain methods calls
- See Also:
WebElement.click()
-
doubleClick
public FluentWebElement doubleClick()
Description copied from interface:FluentActions
Perform a double click.- Specified by:
doubleClick
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- this object reference to chain methods calls
-
contextClick
public FluentWebElement contextClick()
Description copied from interface:FluentActions
Perform a context click.- Specified by:
contextClick
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- this object reference to chain methods calls
-
present
public boolean present()
Description copied from interface:FluentProxyState
Check if the element is present in the DOM.- Specified by:
present
in interfaceFluentProxyState<FluentWebElement>
- Returns:
- true if the element is present, false otherwise
-
now
public FluentWebElement now()
Description copied from interface:FluentProxyState
Search for the element now, actually performing the search on theWebDriver
.It has no effect if the element is already loaded.
- Specified by:
now
in interfaceFluentProxyState<FluentWebElement>
- Returns:
- this object reference to chain calls.
-
now
public FluentWebElement now(boolean force)
Description copied from interface:FluentProxyState
Search for the element now, actually performing the search on theWebDriver
.It has no effect if the element is already loaded.
- Specified by:
now
in interfaceFluentProxyState<FluentWebElement>
- Parameters:
force
- force the search even if element is already loaded- Returns:
- this object reference to chain calls.
-
reset
public FluentWebElement reset()
Description copied from interface:FluentProxyState
Reset the element. Subsequent calls will perform the search again, instead of using the cached result.- Specified by:
reset
in interfaceFluentProxyState<FluentWebElement>
- Returns:
- this object reference to chain calls.
-
loaded
public boolean loaded()
Description copied from interface:FluentProxyState
Check if the element is loaded.- Specified by:
loaded
in interfaceFluentProxyState<FluentWebElement>
- Returns:
- true if the element is loaded, false otherwise
-
axes
@Deprecated public Dom axes()
Deprecated.Usedom()
instead.XPath Axes accessor (parent, ancestors, preceding, following, ...).- Returns:
- object to perform XPath Axes transformations.
-
dom
public Dom dom()
XPath Axes accessor (parent, ancestors, preceding, following, ...).- Returns:
- object to perform XPath Axes transformations.
-
conditions
public FluentConditions conditions()
Get a conditions object used to verify condition on this element.- Returns:
- conditions object
-
await
public FluentWaitElement await()
Build a wait object to wait for a condition of this element.- Returns:
- a wait object
-
mouse
public MouseElementActions mouse()
Execute mouse actions on the element- Returns:
- mouse actions object
-
keyboard
public KeyboardElementActions keyboard()
Execute keyboard actions on the element- Returns:
- keyboard actions object
-
as
public <T> T as(java.lang.Class<T> componentClass)
Wrap all underlying elements in a component.- Type Parameters:
T
- type of component- Parameters:
componentClass
- component class- Returns:
- element as component.
-
clear
public FluentWebElement clear()
Clear the element- Returns:
- fluent web element
-
clearReactInput
public FluentWebElement clearReactInput()
Clear React input using Backspace only- Returns:
- fluent web element
-
submit
public FluentWebElement submit()
Submit the element- Specified by:
submit
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- fluent web element
- See Also:
WebElement.submit()
-
write
public FluentWebElement write(java.lang.String... text)
Set the text element- Specified by:
write
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Parameters:
text
- value to set- Returns:
- fluent web element
- See Also:
WebElement.sendKeys(CharSequence...)
-
name
public java.lang.String name()
return the name of the element- Returns:
- name of the element
-
attribute
public java.lang.String attribute(java.lang.String name)
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:
WebElement.getAttribute(String)
-
cssValue
public java.lang.String cssValue(java.lang.String propertyName)
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:
WebElement.getCssValue(String)
-
id
public java.lang.String id()
return the id of the elements- Returns:
- id of element
-
text
public java.lang.String text()
return the visible text of the element- Returns:
- text of element
- See Also:
WebElement.getText()
-
textContent
public java.lang.String textContent()
return the text content of the element (even invisible through textContent attribute)- Returns:
- text content of element
-
value
public java.lang.String 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:
WebElement.isDisplayed()
-
enabled
public boolean enabled()
return true if the element is enabled, other way return false- Returns:
- boolean value of enabled check
- See Also:
WebElement.isEnabled()
-
selected
public boolean selected()
return true if the element is selected, other way false- Returns:
- boolean value of selected check
- See Also:
WebElement.isSelected()
-
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
public java.lang.String tagName()
return the tag name- Returns:
- string value of tag name
- See Also:
WebElement.getTagName()
-
getElement
public org.openqa.selenium.WebElement getElement()
return the webElement- Returns:
- web element
-
getWrappedElement
public org.openqa.selenium.WebElement getWrappedElement()
- Specified by:
getWrappedElement
in interfaceorg.openqa.selenium.WrapsElement
-
size
public org.openqa.selenium.Dimension size()
return the size of the element- Returns:
- dimension/size of element
- See Also:
WebElement.getSize()
-
asList
public FluentList<FluentWebElement> asList()
Converts this element as a single element list.- Returns:
- list of element
-
find
public FluentList<FluentWebElement> find(org.openqa.selenium.By locator, SearchFilter... filters)
Description copied from interface:SearchControl
Find list of elements with Selenium locator and filters.- Specified by:
find
in interfaceSearchControl<FluentWebElement>
- Parameters:
locator
- elements locatorfilters
- filters set- Returns:
- list of elements
-
find
public FluentList<FluentWebElement> find(java.lang.String selector, SearchFilter... filters)
Description copied from interface:SearchControl
Find list of elements with CSS selector and filters.- Specified by:
find
in interfaceSearchControl<FluentWebElement>
- Parameters:
selector
- CSS selectorfilters
- set of filters- Returns:
- list of element
-
find
public FluentList<FluentWebElement> find(SearchFilter... filters)
Description copied from interface:SearchControl
Find list of elements with filters.- Specified by:
find
in interfaceSearchControl<FluentWebElement>
- Parameters:
filters
- set of filters in the current context- Returns:
- list of elements
-
find
public FluentList<FluentWebElement> find(java.util.List<org.openqa.selenium.WebElement> rawElements)
Description copied from interface:SearchControl
Wrap raw selenium elements into a list of elements.- Specified by:
find
in interfaceSearchControl<FluentWebElement>
- Parameters:
rawElements
- raw selenium elements- Returns:
- list of element
-
$
public FluentList<FluentWebElement> $(java.util.List<org.openqa.selenium.WebElement> rawElements)
Description copied from interface:SearchControl
Wrap raw selenium elements into a list of elements.- Specified by:
$
in interfaceSearchControl<FluentWebElement>
- Parameters:
rawElements
- raw selenium elements- Returns:
- list of element
-
el
public FluentWebElement el(org.openqa.selenium.WebElement rawElement)
Description copied from interface:SearchControl
Wrap existing raw selenium element into an element.- Specified by:
el
in interfaceSearchControl<FluentWebElement>
- Parameters:
rawElement
- raw selenium element- Returns:
- element
-
html
public java.lang.String html()
Get the HTML of a the element- Returns:
- the underlying html content
-
fill
public Fill fill()
Description copied from interface:FluentActions
Construct a Fill Builder in order to allow easy fill of visible input fields.- Specified by:
fill
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- Fill builder
-
fillSelect
public FillSelect fillSelect()
Description copied from interface:FluentActions
Construct a Fill Select Builder in order to allow easy fill of visible input fields.- Specified by:
fillSelect
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- Fill select builder
-
frame
public FluentWebElement frame()
Description copied from interface:FluentActions
Select a frame using this element.- Specified by:
frame
in interfaceFluentActions<FluentWebElement,FluentWebElement>
- Returns:
- this object reference to chain methods calls.
-
optional
public java.util.Optional<FluentWebElement> optional()
Description copied from interface:FluentProxyState
Builds an optional. If underlying element is lazy, search will be perfomed when invoking this method.- Specified by:
optional
in interfaceFluentProxyState<FluentWebElement>
- Returns:
- An optional wrapping this.
- See Also:
FluentProxyState.present()
,FluentProxyState.now()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
noHook
public <R> R noHook(java.lang.Class<? extends FluentHook> hook, java.util.function.Function<FluentWebElement,R> function)
Description copied from interface:HookControl
Invoke a function with no hook.- Specified by:
noHook
in interfaceHookControl<FluentWebElement>
- Type Parameters:
R
- return type- Parameters:
hook
- hook class to disablefunction
- function to invoke- Returns:
- return value of the given function
-
withHook
public <O,H extends FluentHook<O>> FluentWebElement withHook(java.lang.Class<H> hook, O options)
Description copied from interface:HookControl
Enable a hook with given options.- Specified by:
withHook
in 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
public <O,H extends FluentHook<O>> FluentWebElement withHook(java.lang.Class<H> hook)
Description copied from interface:HookControl
Enable a hook with default options.- Specified by:
withHook
in 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
public FluentWebElement noHook(java.lang.Class<? extends FluentHook>... hooks)
Description copied from interface:HookControl
Disable given hook from actual element.- Specified by:
noHook
in interfaceHookControl<FluentWebElement>
- Parameters:
hooks
- hook classes to disable- Returns:
- this object reference to chain calls
-
noHook
public <R> R noHook(java.util.function.Function<FluentWebElement,R> function)
Description copied from interface:HookControl
Invoke a function with no hook.- Specified by:
noHook
in interfaceHookControl<FluentWebElement>
- Type Parameters:
R
- return type- Parameters:
function
- function to invoke- Returns:
- return value of the given function
-
noHookInstance
public FluentWebElement noHookInstance(java.lang.Class<? extends FluentHook>... hooks)
Description copied from interface:HookControl
Creates a new element locator instance with given hook disabled.- Specified by:
noHookInstance
in interfaceHookControl<FluentWebElement>
- Parameters:
hooks
- hook classes to disable- Returns:
- new element locator with hook disabled.
-
restoreHooks
public FluentWebElement restoreHooks()
Description copied from interface:HookControl
Retore hooks that were defined initially.- Specified by:
restoreHooks
in interfaceHookControl<FluentWebElement>
- Returns:
- this object reference to chain calls
-
noHookInstance
public FluentWebElement noHookInstance()
Description copied from interface:HookControl
Creates a new element locator instance with all hooks disabled.- Specified by:
noHookInstance
in interfaceHookControl<FluentWebElement>
- Returns:
- new element locator with hook disabled.
-
noHook
public FluentWebElement noHook()
Description copied from interface:HookControl
Disable all hooks from actual element.- Specified by:
noHook
in interfaceHookControl<FluentWebElement>
- Returns:
- this object reference to chain calls
-
scrollToCenter
public FluentWebElement scrollToCenter()
Description copied from interface:FluentJavascriptActions
Scrolls center of the current element into the visible area of the browser window, respecting window size.- Specified by:
scrollToCenter
in interfaceFluentJavascriptActions
- Returns:
- this object reference to chain methods calls
-
scrollIntoView
public FluentWebElement scrollIntoView()
Description copied from interface:FluentJavascriptActions
Scrolls the current element into the visible area of the browser window.- Specified by:
scrollIntoView
in interfaceFluentJavascriptActions
- Returns:
- this object reference to chain methods calls
- See Also:
- element.scrollIntoView
-
scrollIntoView
public FluentWebElement scrollIntoView(boolean alignWithTop)
Description copied from interface:FluentJavascriptActions
Scrolls the current element into the visible area of the browser window.- Specified by:
scrollIntoView
in 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:
- element.scrollIntoView
-
modifyAttribute
public FluentWebElement modifyAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Description copied from interface:FluentJavascriptActions
Modifies element attributes- Specified by:
modifyAttribute
in interfaceFluentJavascriptActions
- Returns:
- this object reference to chain methods calls
-
withLabelHint
public FluentWebElement withLabelHint(java.lang.String... labelHint)
Description copied from interface:FluentLabel
Add a label hint that will be appended to the representation of this object for error message.- Specified by:
withLabelHint
in interfaceFluentLabel<FluentWebElement>
- Parameters:
labelHint
- label hints to add- Returns:
- reference to this object to chain calls
-
withLabel
public FluentWebElement withLabel(java.lang.String label)
Description copied from interface:FluentLabel
Apply a label that will be displayed as the representation of this object for error message.- Specified by:
withLabel
in interfaceFluentLabel<FluentWebElement>
- Parameters:
label
- label to use- Returns:
- reference to this object to chain calls
-
-