|
||||||||||
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. |
List<WebElement> |
findElements(By by)
Find all elements within the current context using the given mechanism. |
String |
getAttribute(String name)
Get the value of a the given attribute of the element. |
String |
getCssValue(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? |
String |
getTagName()
Get the tag name of this element. |
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(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()
void submit()
NoSuchElementException
- If the given element is not within a formvoid sendKeys(CharSequence... keysToSend)
void clear()
String getTagName()
"input"
for the element <input name="foo" />
.
String getAttribute(String name)
name
- The name of the attribute.
boolean isSelected()
boolean isEnabled()
String getText()
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
WebElement findElement(By by)
WebElement
using the given method. See the note in
findElement(By)
about finding via XPath.
findElement
in interface SearchContext
by
- The locating mechanism
NoSuchElementException
- If no matching elements are foundboolean isDisplayed()
Point getLocation()
Dimension getSize()
String getCssValue(String propertyName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |