public class RemoteWebElement extends java.lang.Object implements WebElement, FindsByLinkText, FindsById, FindsByName, FindsByTagName, FindsByClassName, FindsByCssSelector, FindsByXPath, WrapsDriver, Locatable, HasIdentity, TakesScreenshot
Modifier and Type | Field and Description |
---|---|
protected FileDetector |
fileDetector |
protected java.lang.String |
id |
protected org.openqa.selenium.remote.RemoteMouse |
mouse |
protected RemoteWebDriver |
parent |
Constructor and Description |
---|
RemoteWebElement() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
If this element is a text entry element, this will clear the value.
|
void |
click()
Click this element.
|
boolean |
equals(java.lang.Object obj) |
protected Response |
execute(java.lang.String command,
java.util.Map<java.lang.String,?> parameters) |
WebElement |
findElement(By by)
Find the first
WebElement using the given method. |
protected WebElement |
findElement(java.lang.String using,
java.lang.String value) |
WebElement |
findElementByClassName(java.lang.String using) |
WebElement |
findElementByCssSelector(java.lang.String using) |
WebElement |
findElementById(java.lang.String using) |
WebElement |
findElementByLinkText(java.lang.String using) |
WebElement |
findElementByName(java.lang.String using) |
WebElement |
findElementByPartialLinkText(java.lang.String using) |
WebElement |
findElementByTagName(java.lang.String using) |
WebElement |
findElementByXPath(java.lang.String using) |
java.util.List<WebElement> |
findElements(By by)
Find all elements within the current context using the given mechanism.
|
protected java.util.List<WebElement> |
findElements(java.lang.String using,
java.lang.String value) |
java.util.List<WebElement> |
findElementsByClassName(java.lang.String using) |
java.util.List<WebElement> |
findElementsByCssSelector(java.lang.String using) |
java.util.List<WebElement> |
findElementsById(java.lang.String using) |
java.util.List<WebElement> |
findElementsByLinkText(java.lang.String using) |
java.util.List<WebElement> |
findElementsByName(java.lang.String using) |
java.util.List<WebElement> |
findElementsByPartialLinkText(java.lang.String using) |
java.util.List<WebElement> |
findElementsByTagName(java.lang.String using) |
java.util.List<WebElement> |
findElementsByXPath(java.lang.String using) |
java.lang.String |
getAttribute(java.lang.String name)
Get the value of a the given attribute of the element.
|
Coordinates |
getCoordinates() |
java.lang.String |
getCssValue(java.lang.String propertyName)
Get the value of a given CSS property.
|
java.lang.String |
getId() |
Point |
getLocation()
Where on the page is the top left-hand corner of the rendered element?
|
<X> X |
getScreenshotAs(OutputType<X> outputType)
Capture the screenshot and store it in the specified location.
|
Dimension |
getSize()
What is the width and height of the rendered element?
|
java.lang.String |
getTagName()
Get the tag name of this element.
|
java.lang.String |
getText()
Get the visible (i.e.
|
WebDriver |
getWrappedDriver() |
int |
hashCode() |
boolean |
isDisplayed()
Is this element displayed or not? This method avoids the problem of having to parse an
element's "style" attribute.
|
boolean |
isEnabled()
Is the element currently enabled or not? This will generally return true for everything but
disabled input elements.
|
boolean |
isSelected()
Determine whether or not this element is selected or not.
|
void |
sendKeys(java.lang.CharSequence... keysToSend)
Use this method to simulate typing into an element, which may set its value.
|
void |
setFileDetector(FileDetector detector) |
protected void |
setFoundBy(SearchContext foundFrom,
java.lang.String locator,
java.lang.String term) |
void |
setId(java.lang.String id) |
void |
setParent(RemoteWebDriver parent) |
void |
submit()
If this current element is a form, or an element within a form, then this will be submitted to
the remote server.
|
java.lang.String |
toString() |
protected java.lang.String id
protected RemoteWebDriver parent
protected org.openqa.selenium.remote.RemoteMouse mouse
protected FileDetector fileDetector
protected void setFoundBy(SearchContext foundFrom, java.lang.String locator, java.lang.String term)
public void setParent(RemoteWebDriver parent)
public java.lang.String getId()
getId
in interface HasIdentity
public void setId(java.lang.String id)
public void setFileDetector(FileDetector detector)
public void click()
WebElement
click
in interface WebElement
public void submit()
WebElement
submit
in interface WebElement
public void sendKeys(java.lang.CharSequence... keysToSend)
WebElement
sendKeys
in interface WebElement
keysToSend
- character sequence to send to the elementpublic void clear()
WebElement
WebElement.sendKeys(CharSequence...)
with the backspace key. To ensure
you get a change event, consider following with a call to WebElement.sendKeys(CharSequence...)
with the tab key.clear
in interface WebElement
public java.lang.String getTagName()
WebElement
"input"
for the element <input name="foo" />
.getTagName
in interface WebElement
public java.lang.String getAttribute(java.lang.String name)
WebElement
getAttribute
in interface WebElement
name
- The name of the attribute.public boolean isSelected()
WebElement
isSelected
in interface WebElement
public boolean isEnabled()
WebElement
isEnabled
in interface WebElement
public java.lang.String getText()
WebElement
getText
in interface WebElement
public java.lang.String getCssValue(java.lang.String propertyName)
WebElement
getCssValue
in interface WebElement
propertyName
- the css property name of the elementpublic java.util.List<WebElement> findElements(By by)
WebElement
findElements
in interface SearchContext
findElements
in interface WebElement
by
- The locating mechanism to useWebElement
s, or an empty list if nothing matches.By
,
WebDriver.Timeouts
public WebElement findElement(By by)
WebElement
WebElement
using the given method. See the note in
WebElement.findElements(By)
about finding via XPath.
This method is affected by the 'implicit wait' times in force at the time of execution.
The findElement(..) invocation will return a matching row, or try again repeatedly until
the configured timeout is reached.
findElement should not be used to look for non-present elements, use WebElement.findElements(By)
and assert zero length response instead.findElement
in interface SearchContext
findElement
in interface WebElement
by
- The locating mechanismBy
,
WebDriver.Timeouts
protected WebElement findElement(java.lang.String using, java.lang.String value)
protected java.util.List<WebElement> findElements(java.lang.String using, java.lang.String value)
public WebElement findElementById(java.lang.String using)
findElementById
in interface FindsById
public java.util.List<WebElement> findElementsById(java.lang.String using)
findElementsById
in interface FindsById
public WebElement findElementByLinkText(java.lang.String using)
findElementByLinkText
in interface FindsByLinkText
public java.util.List<WebElement> findElementsByLinkText(java.lang.String using)
findElementsByLinkText
in interface FindsByLinkText
public WebElement findElementByName(java.lang.String using)
findElementByName
in interface FindsByName
public java.util.List<WebElement> findElementsByName(java.lang.String using)
findElementsByName
in interface FindsByName
public WebElement findElementByClassName(java.lang.String using)
findElementByClassName
in interface FindsByClassName
public java.util.List<WebElement> findElementsByClassName(java.lang.String using)
findElementsByClassName
in interface FindsByClassName
public WebElement findElementByCssSelector(java.lang.String using)
findElementByCssSelector
in interface FindsByCssSelector
public java.util.List<WebElement> findElementsByCssSelector(java.lang.String using)
findElementsByCssSelector
in interface FindsByCssSelector
public WebElement findElementByXPath(java.lang.String using)
findElementByXPath
in interface FindsByXPath
public java.util.List<WebElement> findElementsByXPath(java.lang.String using)
findElementsByXPath
in interface FindsByXPath
public WebElement findElementByPartialLinkText(java.lang.String using)
findElementByPartialLinkText
in interface FindsByLinkText
public java.util.List<WebElement> findElementsByPartialLinkText(java.lang.String using)
findElementsByPartialLinkText
in interface FindsByLinkText
public WebElement findElementByTagName(java.lang.String using)
findElementByTagName
in interface FindsByTagName
public java.util.List<WebElement> findElementsByTagName(java.lang.String using)
findElementsByTagName
in interface FindsByTagName
protected Response execute(java.lang.String command, java.util.Map<java.lang.String,?> parameters)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public WebDriver getWrappedDriver()
getWrappedDriver
in interface WrapsDriver
public boolean isDisplayed()
WebElement
isDisplayed
in interface WebElement
public Point getLocation()
WebElement
getLocation
in interface WebElement
public Dimension getSize()
WebElement
getSize
in interface WebElement
public Coordinates getCoordinates()
getCoordinates
in interface Locatable
@Beta public <X> X getScreenshotAs(OutputType<X> outputType) throws WebDriverException
TakesScreenshot
For WebDriver extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference:
For WebElement extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference: - The entire content of the HTML element - The visisble portion of the HTML element
getScreenshotAs
in interface TakesScreenshot
X
- Return type for getScreenshotAs.outputType
- target type, @see OutputTypeWebDriverException
- on failure.public java.lang.String toString()
toString
in class java.lang.Object