@Internal public class WebDriverElement extends Object implements PageElement
PageElement that waits for element to be
present before executing each actions.| Modifier and Type | Field and Description |
|---|---|
protected TimeoutType |
defaultTimeout |
protected org.openqa.selenium.WebDriver |
driver |
protected WebDriverLocatable |
locatable |
protected PageBinder |
pageBinder |
protected Timeouts |
timeouts |
static com.google.common.base.Function<PageElement,WebDriverLocatable> |
TO_LOCATABLE |
| Constructor and Description |
|---|
WebDriverElement(org.openqa.selenium.By locator)
Creates a WebDriverElement within the driver's search context and default timeout
|
WebDriverElement(org.openqa.selenium.By locator,
TimeoutType timeoutType)
Creates a WebDriverElement within the driver's search context and given timeout type.
|
WebDriverElement(org.openqa.selenium.By locator,
WebDriverLocatable parent)
Creates a WebDriverElement within a given parent and default timeout.
|
WebDriverElement(org.openqa.selenium.By locator,
WebDriverLocatable parent,
TimeoutType timeoutType)
Creates a WebDriverElement within a given parent and given timeout type.
|
WebDriverElement(WebDriverLocatable locatable,
TimeoutType timeoutType)
Creates a WebDriverElement with the given locatable and timeout type.
|
| Modifier and Type | Method and Description |
|---|---|
org.openqa.selenium.WebElement |
asWebElement()
This allows retrieving the web element from the page element.
|
static <P extends PageElement> |
bind(PageBinder pageBinder,
Class<P> elementType,
TimeoutType timeoutType) |
PageElement |
clear()
Clear the value of the text entry element.
|
PageElement |
click()
Click this element
|
protected WebDriverLocatable.LocateTimeout |
createTimout() |
PageElement |
find(org.openqa.selenium.By locator)
Returns an element that will match the given locator within this element.
|
<T extends PageElement> |
find(org.openqa.selenium.By locator,
Class<T> elementClass)
Creates
PageElement extension of type T using the specified
locator and default timeout. |
<T extends PageElement> |
find(org.openqa.selenium.By locator,
Class<T> elementClass,
TimeoutType timeoutType)
Creates
PageElement extension of type T using the specified
locator and given timeoutType |
PageElement |
find(org.openqa.selenium.By locator,
TimeoutType timeoutType)
Creates
PageElement implementation
using the specified locator and given timeoutType. |
List<PageElement> |
findAll(org.openqa.selenium.By locator)
Returns a list of element's that match the given locator within this element
|
<T extends PageElement> |
findAll(org.openqa.selenium.By locator,
Class<T> elementClass)
Creates (@Link PageElement) extension of type T for each element that matches the given
locator with default timeout
|
<T extends PageElement> |
findAll(org.openqa.selenium.By locator,
Class<T> elementClass,
TimeoutType timeoutType)
Creates (@Link PageElement) extension of type T for each element that matches the given
locator with timeoutType
|
List<PageElement> |
findAll(org.openqa.selenium.By locator,
TimeoutType timeoutType)
Creates a
PageElement for each element that matches the given locator
using timeoutType. |
String |
getAttribute(String name)
Get the value of the given attribute of this element.
|
Set<String> |
getCssClasses()
Get a set of CSS classes associated with this element.
|
TimeoutType |
getDefaultTimeout() |
String |
getId() |
org.openqa.selenium.Point |
getLocation()
Location of this element on the page (top-left corner)
|
org.openqa.selenium.Dimension |
getSize()
Dimension of this element on the page
|
String |
getTagName()
Get the tag name of this element
|
String |
getText()
Get the visible innerText of this element, including sub-elements, without any leading or trailing whitespaces.
|
String |
getValue()
Get the value of this element's "value" attribute.
|
boolean |
hasAttribute(String name,
String value)
Whether this element has an attribute set to a specific value
|
boolean |
hasClass(String className)
Whether this element has the given class set
|
boolean |
isEnabled()
Whether this element is enabled on the page
|
boolean |
isPresent()
Whether this element is currently on the DOM of the page
|
boolean |
isSelected()
Whether this element is selected on the page.
|
boolean |
isVisible()
Whether this element is visible on the page
|
PageElementJavascript |
javascript()
Gets a PageElementJavascript for this element
|
DefaultQuery |
search() |
PageElement |
select()
Select an element.
|
TimedElement |
timed()
Creates a timed element based on this element's locator.
|
protected long |
timeout() |
PageElement |
toggle()
If the element is a checkbox this will toggle the elements state from selected to not selected, or from not selected to selected.
|
static WebDriverLocatable |
toLocatable(PageElement pageElement) |
String |
toString() |
PageElement |
type(CharSequence... keysToSend)
Simulate typing into this element.
|
protected org.openqa.selenium.WebElement |
waitForWebElement() |
protected org.openqa.selenium.WebElement |
waitForWebElement(WebDriverLocatable.LocateTimeout timeout) |
PageElement |
withTimeout(TimeoutType timeoutType)
Returns an instance equivalent to this element, with a changed timeoutType.
|
public static com.google.common.base.Function<PageElement,WebDriverLocatable> TO_LOCATABLE
@Inject protected org.openqa.selenium.WebDriver driver
@Inject protected PageBinder pageBinder
@Inject protected Timeouts timeouts
protected final WebDriverLocatable locatable
protected final TimeoutType defaultTimeout
public WebDriverElement(org.openqa.selenium.By locator)
locator - The locator mechanism to use.public WebDriverElement(org.openqa.selenium.By locator,
TimeoutType timeoutType)
locator - The locator mechanism to use.timeoutType - default timeout of this elementpublic WebDriverElement(org.openqa.selenium.By locator,
WebDriverLocatable parent)
locator - The locator mechanism to use.parent - The locatable parent of this element.public WebDriverElement(org.openqa.selenium.By locator,
WebDriverLocatable parent,
TimeoutType timeoutType)
locator - The locator mechanism to use.parent - The locatable parent of this element.timeoutType - default timeout of this elementpublic WebDriverElement(WebDriverLocatable locatable, TimeoutType timeoutType)
locatable - WebDriverLocatable that that locate this elementtimeoutType - default timeout of this element@Nonnull public static <P extends PageElement> com.google.common.base.Function<WebDriverLocatable,P> bind(@Nonnull PageBinder pageBinder, @Nonnull Class<P> elementType, @Nonnull TimeoutType timeoutType)
@Nonnull public static WebDriverLocatable toLocatable(@Nonnull PageElement pageElement)
protected long timeout()
protected WebDriverLocatable.LocateTimeout createTimout()
public boolean isPresent()
PageElementisPresent in interface PageElementpublic boolean isVisible()
PageElementisVisible in interface PageElementpublic boolean isEnabled()
PageElementisEnabled in interface PageElementpublic boolean isSelected()
PageElementtrue if the checkbox is checked.
For radio buttons, returns true
if the radio button this class represents is selected.isSelected in interface PageElementtrue if this element is selected, false otherwise.@Nullable public String getId()
getId in interface PageElementnull if the "id" attribute is not defined@Nonnull public Set<String> getCssClasses()
PageElementgetCssClasses in interface PageElementpublic boolean hasClass(@Nonnull String className)
PageElementhasClass in interface PageElementclassName - The name of the class to checkpublic String getAttribute(@Nonnull String name)
PageElementgetAttribute in interface PageElementname - The name of the attribute.public boolean hasAttribute(@Nonnull String name, String value)
PageElementhasAttribute in interface PageElementname - The attribute namevalue - The expected valuepublic String getText()
PageElementgetText in interface PageElement@Nonnull public String getTagName()
PageElementgetTagName in interface PageElementpublic String getValue()
PageElementgetValue in interface PageElement@Nonnull public org.openqa.selenium.Point getLocation()
PageElementgetLocation in interface PageElement@Nonnull public org.openqa.selenium.Dimension getSize()
PageElementgetSize in interface PageElement@Nonnull public PageElement click()
PageElementclick in interface PageElement@Nonnull public PageElement type(CharSequence... keysToSend)
PageElementtype in interface PageElementkeysToSend - keys to type@Nonnull public PageElement select()
PageElementselect in interface PageElement@Nonnull public PageElement toggle()
PageElementtoggle in interface PageElement@Nonnull public PageElement clear()
PageElementclear in interface PageElement@Nonnull public TimedElement timed()
PageElementtimed in interface PageElement@Nonnull public PageElementJavascript javascript()
PageElementjavascript in interface PageElement@Nonnull public PageElement find(@Nonnull org.openqa.selenium.By locator)
PageElementPageElement.isPresent()
to check whether a corresponding element on the page actually exists.find in interface PageElementfind in interface PageElementFinderlocator - The locator mechanism@Nonnull public PageElement find(@Nonnull org.openqa.selenium.By locator, @Nonnull TimeoutType timeoutType)
PageElementFinderPageElement implementation
using the specified locator and given timeoutType.find in interface PageElementFinderlocator - Locator mechanism to usetimeoutType - timeout for the element's timed operations@Nonnull public <T extends PageElement> T find(@Nonnull org.openqa.selenium.By locator, @Nonnull Class<T> elementClass)
PageElementFinderPageElement extension of type T using the specified
locator and default timeout.find in interface PageElementFinderlocator - Locator mechanism to useelementClass - The class of the element to create@Nonnull public <T extends PageElement> T find(@Nonnull org.openqa.selenium.By locator, @Nonnull Class<T> elementClass, @Nonnull TimeoutType timeoutType)
PageElementFinderPageElement extension of type T using the specified
locator and given timeoutTypefind in interface PageElementFinderlocator - Locator mechanism to useelementClass - The class of the element to createtimeoutType - timeout for the element's timed operations@Nonnull public List<PageElement> findAll(@Nonnull org.openqa.selenium.By locator)
PageElementfindAll in interface PageElementfindAll in interface PageElementFinderlocator - The locator mecharnism@Nonnull public List<PageElement> findAll(@Nonnull org.openqa.selenium.By locator, @Nonnull TimeoutType timeoutType)
PageElementFinderPageElement for each element that matches the given locator
using timeoutType.findAll in interface PageElementFinderlocator - Locator mechanism to usetimeoutType - timeout for the element's timed operations@Nonnull public <T extends PageElement> List<T> findAll(@Nonnull org.openqa.selenium.By locator, @Nonnull Class<T> elementClass)
PageElementFinderfindAll in interface PageElementFinderlocator - Locator mechanism to useelementClass - The class of the element to create@Nonnull public <T extends PageElement> List<T> findAll(@Nonnull org.openqa.selenium.By locator, @Nonnull Class<T> elementClass, @Nonnull TimeoutType timeoutType)
PageElementFinderfindAll in interface PageElementFinderlocator - Locator mechanism to useelementClass - The class of the element to createtimeoutType - timeout for the element's timed operations@Nonnull public PageElement withTimeout(@Nonnull TimeoutType timeoutType)
PageElementwithTimeout in interface PageElementtimeoutType - new timeout@Nonnull public DefaultQuery search()
search in interface PageElementSearch@Nonnull public org.openqa.selenium.WebElement asWebElement()
@Nonnull public TimeoutType getDefaultTimeout()
protected org.openqa.selenium.WebElement waitForWebElement()
protected org.openqa.selenium.WebElement waitForWebElement(WebDriverLocatable.LocateTimeout timeout)
Copyright © 2015 Atlassian. All rights reserved.