public class RemoteWebElement extends Object implements WebElement, FindsByLinkText, FindsById, FindsByName, FindsByTagName, FindsByClassName, FindsByCssSelector, FindsByXPath, WrapsDriver, Locatable, HasIdentity, TakesScreenshot
| 构造器和说明 |
|---|
RemoteWebElement() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
If this element is a text entry element, this will clear the value.
|
void |
click()
Click this element.
|
boolean |
equals(Object obj) |
WebElement |
findElement(By by)
Find the first
WebElement using the given method. |
WebElement |
findElementByClassName(String using) |
WebElement |
findElementByCssSelector(String using) |
WebElement |
findElementById(String using) |
WebElement |
findElementByLinkText(String using) |
WebElement |
findElementByName(String using) |
WebElement |
findElementByPartialLinkText(String using) |
WebElement |
findElementByTagName(String using) |
WebElement |
findElementByXPath(String using) |
List<WebElement> |
findElements(By by)
Find all elements within the current context using the given mechanism.
|
List<WebElement> |
findElementsByClassName(String using) |
List<WebElement> |
findElementsByCssSelector(String using) |
List<WebElement> |
findElementsById(String using) |
List<WebElement> |
findElementsByLinkText(String using) |
List<WebElement> |
findElementsByName(String using) |
List<WebElement> |
findElementsByPartialLinkText(String using) |
List<WebElement> |
findElementsByTagName(String using) |
List<WebElement> |
findElementsByXPath(String using) |
String |
getAttribute(String name)
Get the value of the given attribute of the element.
|
Coordinates |
getCoordinates() |
String |
getCssValue(String propertyName)
Get the value of a given CSS property.
|
String |
getId() |
Point |
getLocation()
Where on the page is the top left-hand corner of the rendered element?
|
Rectangle |
getRect() |
<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?
|
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.
|
WebDriver |
getWrappedDriver() |
int |
hashCode() |
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 |
setFileDetector(FileDetector detector) |
void |
setId(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.
|
String |
toString() |
public void setParent(RemoteWebDriver parent)
public String getId()
getId 在接口中 HasIdentitypublic void setId(String id)
public void setFileDetector(FileDetector detector)
public void click()
WebElementclick 在接口中 WebElementpublic void submit()
WebElementsubmit 在接口中 WebElementpublic void sendKeys(CharSequence... keysToSend)
WebElementsendKeys 在接口中 WebElementkeysToSend - character sequence to send to the elementpublic void clear()
WebElementWebElement.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 在接口中 WebElementpublic String getTagName()
WebElement"input" for the element <input name="foo" />.getTagName 在接口中 WebElementpublic String getAttribute(String name)
WebElementMore exactly, this method will return the value of the property with the given name, if it exists. If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
getAttribute 在接口中 WebElementname - The name of the attribute.public boolean isSelected()
WebElementisSelected 在接口中 WebElementpublic boolean isEnabled()
WebElementisEnabled 在接口中 WebElementpublic String getText()
WebElementgetText 在接口中 WebElementpublic String getCssValue(String propertyName)
WebElementgetCssValue 在接口中 WebElementpropertyName - the css property name of the elementpublic List<WebElement> findElements(By by)
WebElementfindElements 在接口中 SearchContextfindElements 在接口中 WebElementby - The locating mechanism to useWebElements, or an empty list if nothing matches.By,
WebDriver.Timeoutspublic WebElement findElement(By by)
WebElementWebElement 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 在接口中 SearchContextfindElement 在接口中 WebElementby - The locating mechanismBy,
WebDriver.Timeoutspublic WebElement findElementById(String using)
findElementById 在接口中 FindsByIdpublic List<WebElement> findElementsById(String using)
findElementsById 在接口中 FindsByIdpublic WebElement findElementByLinkText(String using)
findElementByLinkText 在接口中 FindsByLinkTextpublic List<WebElement> findElementsByLinkText(String using)
findElementsByLinkText 在接口中 FindsByLinkTextpublic WebElement findElementByName(String using)
findElementByName 在接口中 FindsByNamepublic List<WebElement> findElementsByName(String using)
findElementsByName 在接口中 FindsByNamepublic WebElement findElementByClassName(String using)
findElementByClassName 在接口中 FindsByClassNamepublic List<WebElement> findElementsByClassName(String using)
findElementsByClassName 在接口中 FindsByClassNamepublic WebElement findElementByCssSelector(String using)
findElementByCssSelector 在接口中 FindsByCssSelectorpublic List<WebElement> findElementsByCssSelector(String using)
findElementsByCssSelector 在接口中 FindsByCssSelectorpublic WebElement findElementByXPath(String using)
findElementByXPath 在接口中 FindsByXPathpublic List<WebElement> findElementsByXPath(String using)
findElementsByXPath 在接口中 FindsByXPathpublic WebElement findElementByPartialLinkText(String using)
findElementByPartialLinkText 在接口中 FindsByLinkTextpublic List<WebElement> findElementsByPartialLinkText(String using)
findElementsByPartialLinkText 在接口中 FindsByLinkTextpublic WebElement findElementByTagName(String using)
findElementByTagName 在接口中 FindsByTagNamepublic List<WebElement> findElementsByTagName(String using)
findElementsByTagName 在接口中 FindsByTagNamepublic int hashCode()
public WebDriver getWrappedDriver()
getWrappedDriver 在接口中 WrapsDriverpublic boolean isDisplayed()
WebElementisDisplayed 在接口中 WebElementpublic Point getLocation()
WebElementgetLocation 在接口中 WebElementpublic Dimension getSize()
WebElementgetSize 在接口中 WebElementpublic Rectangle getRect()
getRect 在接口中 WebElementpublic Coordinates getCoordinates()
getCoordinates 在接口中 Locatable@Beta public <X> X getScreenshotAs(OutputType<X> outputType) throws WebDriverException
TakesScreenshotFor 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 visible portion of the HTML element
getScreenshotAs 在接口中 TakesScreenshotX - Return type for getScreenshotAs.outputType - target type, @see OutputTypeWebDriverException - on failure.