|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WebElement
Represents an HTML element. Generally, all interesting operations to do with interacting with a page will be performed through this interface.
All method calls will do a freshness check to ensure that the element reference is still valid. This essentially determines whether or not the element is still attached to the DOM. If this test fails, then anStaleElementReferenceException
is thrown, and all
future calls to this instance will fail.
Method Summary | |
---|---|
void |
clear()
If this element is a text entry element, this will clear the value. |
void |
click()
Click this element. |
WebElement |
findElement(By by)
Find the first WebElement using the given method. |
java.util.List<WebElement> |
findElements(By by)
Find all elements within the current context using the given mechanism. |
java.lang.String |
getAttribute(java.lang.String name)
Get the value of a the given attribute of the element. |
java.lang.String |
getCssValue(java.lang.String propertyName)
Get the value of a given CSS property. |
Point |
getLocation()
Where on the page is the top left-hand corner of the rendered element? |
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. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace. |
boolean |
isDisplayed()
Is this element displayed or not? |
boolean |
isEnabled()
Is the element currently enabled or not? |
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 |
submit()
If this current element is a form, or an element within a form, then this will be submitted to the remote server. |
Method Detail |
---|
void click()
StaleElementReferenceException
- If the element no longer exists as initially definedvoid submit()
NoSuchElementException
- If the given element is not within a formvoid sendKeys(java.lang.CharSequence... keysToSend)
void clear()
java.lang.String getTagName()
"input"
for the element <input name="foo" />
.
java.lang.String getAttribute(java.lang.String name)
name
- The name of the attribute.
boolean isSelected()
boolean isEnabled()
java.lang.String getText()
java.util.List<WebElement> findElements(By by)
findElements
in interface SearchContext
by
- The locating mechanism to use
WebElement
s, or an empty list if nothing matches.By
,
WebDriver.Timeouts
WebElement findElement(By by)
WebElement
using the given method. See the note in
findElement(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 findElements(By)
and assert zero length response instead.
findElement
in interface SearchContext
by
- The locating mechanism
NoSuchElementException
- If no matching elements are foundBy
,
WebDriver.Timeouts
boolean isDisplayed()
Point getLocation()
Dimension getSize()
java.lang.String getCssValue(java.lang.String propertyName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |