| 程序包 | 说明 |
|---|---|
| org.openqa.selenium | |
| org.openqa.selenium.remote | |
| org.openqa.selenium.support | |
| org.openqa.selenium.support.events | |
| org.openqa.selenium.support.pagefactory | |
| org.openqa.selenium.support.ui |
| 限定符和类型 | 类和说明 |
|---|---|
static class |
By.ByClassName |
static class |
By.ByCssSelector |
static class |
By.ById |
static class |
By.ByLinkText |
static class |
By.ByName |
static class |
By.ByPartialLinkText |
static class |
By.ByTagName |
static class |
By.ByXPath |
| 限定符和类型 | 方法和说明 |
|---|---|
static By |
By.className(String className)
Finds elements based on the value of the "class" attribute.
|
static By |
By.cssSelector(String selector)
Finds elements via the driver's underlying W3 Selector engine.
|
static By |
By.id(String id) |
static By |
By.linkText(String linkText) |
static By |
By.name(String name) |
static By |
By.partialLinkText(String linkText) |
static By |
By.tagName(String name) |
static By |
By.xpath(String xpathExpression) |
| 限定符和类型 | 方法和说明 |
|---|---|
WebElement |
WebElement.findElement(By by)
Find the first
WebElement using the given method. |
WebElement |
WebDriver.findElement(By by)
Find the first
WebElement using the given method. |
WebElement |
SearchContext.findElement(By by)
Find the first
WebElement using the given method. |
List<WebElement> |
WebElement.findElements(By by)
Find all elements within the current context using the given mechanism.
|
List<WebElement> |
WebDriver.findElements(By by)
Find all elements within the current page using the given mechanism.
|
List<WebElement> |
SearchContext.findElements(By by)
Find all elements within the current context using the given mechanism.
|
| 限定符和类型 | 方法和说明 |
|---|---|
WebElement |
RemoteWebElement.findElement(By by) |
WebElement |
RemoteWebDriver.findElement(By by) |
List<WebElement> |
RemoteWebElement.findElements(By by) |
List<WebElement> |
RemoteWebDriver.findElements(By by) |
| 限定符和类型 | 类和说明 |
|---|---|
class |
ByIdOrName |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
WebDriverEventListener.afterFindBy(By by,
WebElement element,
WebDriver driver)
Called after
WebDriver.findElement(...), or
WebDriver.findElements(...), or WebElement.findElement(...), or WebElement.findElements(...). |
void |
AbstractWebDriverEventListener.afterFindBy(By by,
WebElement element,
WebDriver driver) |
void |
WebDriverEventListener.beforeFindBy(By by,
WebElement element,
WebDriver driver)
Called before
WebDriver.findElement(...), or
WebDriver.findElements(...), or WebElement.findElement(...), or WebElement.findElements(...). |
void |
AbstractWebDriverEventListener.beforeFindBy(By by,
WebElement element,
WebDriver driver) |
WebElement |
EventFiringWebDriver.findElement(By by) |
List<WebElement> |
EventFiringWebDriver.findElements(By by) |
| 限定符和类型 | 类和说明 |
|---|---|
class |
ByAll
Mechanism used to locate elements within a document using a series of lookups.
|
class |
ByChained
Mechanism used to locate elements within a document using a series of other lookups.
|
| 限定符和类型 | 方法和说明 |
|---|---|
By |
Annotations.buildBy()
Defines how to transform given object (field, class, etc)
into
By class used by webdriver to locate elements. |
abstract By |
AbstractAnnotations.buildBy()
Defines how to transform given object (field, class, etc)
into
By class used by webdriver to locate elements. |
| 构造器和说明 |
|---|
ByAll(By... bys) |
ByChained(By... bys) |
| 限定符和类型 | 方法和说明 |
|---|---|
static ExpectedCondition<Boolean> |
ExpectedConditions.attributeContains(By locator,
String attribute,
String value)
An expectation for checking WebElement with given locator has attribute which contains specific
value
|
static ExpectedCondition<Boolean> |
ExpectedConditions.attributeToBe(By locator,
String attribute,
String value)
An expectation for checking WebElement with given locator has attribute with a specific value
|
static ExpectedCondition<Boolean> |
ExpectedConditions.elementSelectionStateToBe(By locator,
boolean selected) |
static ExpectedCondition<WebElement> |
ExpectedConditions.elementToBeClickable(By locator)
An expectation for checking an element is visible and enabled such that you can click it.
|
static ExpectedCondition<Boolean> |
ExpectedConditions.elementToBeSelected(By locator) |
static ExpectedCondition<WebDriver> |
ExpectedConditions.frameToBeAvailableAndSwitchToIt(By locator)
An expectation for checking whether the given frame is available to switch to.
|
static ExpectedCondition<Boolean> |
ExpectedConditions.invisibilityOfElementLocated(By locator)
An expectation for checking that an element is either invisible or not present on the DOM.
|
static ExpectedCondition<Boolean> |
ExpectedConditions.invisibilityOfElementWithText(By locator,
String text)
An expectation for checking that an element with text is either invisible or not present on the
DOM.
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.numberOfElementsToBe(By locator,
Integer number)
An expectation for checking number of WebElements with given locator
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.numberOfElementsToBeLessThan(By locator,
Integer number)
An expectation for checking number of WebElements with given locator being less than defined
number
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.numberOfElementsToBeMoreThan(By locator,
Integer number)
An expectation for checking number of WebElements with given locator
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.presenceOfAllElementsLocatedBy(By locator)
An expectation for checking that there is at least one element present on a web page.
|
static ExpectedCondition<WebElement> |
ExpectedConditions.presenceOfElementLocated(By locator)
An expectation for checking that an element is present on the DOM of a page.
|
static ExpectedCondition<WebElement> |
ExpectedConditions.presenceOfNestedElementLocatedBy(By locator,
By sub_locator)
An expectation for checking child WebElement as a part of parent element to present
|
static ExpectedCondition<WebElement> |
ExpectedConditions.presenceOfNestedElementLocatedBy(WebElement element,
By sub_locator)
An expectation for checking child WebElement as a part of parent element to be present
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.presenceOfNestedElementsLocatedBy(By locator,
By sub_locator)
An expectation for checking child WebElement as a part of parent element to present
|
static ExpectedCondition<Boolean> |
ExpectedConditions.textMatches(By locator,
Pattern pattern)
An expectation for checking WebElement with given locator has text with a value as a part of
it
|
static ExpectedCondition<Boolean> |
ExpectedConditions.textToBe(By locator,
String value)
An expectation for checking WebElement with given locator has specific text
|
static ExpectedCondition<Boolean> |
ExpectedConditions.textToBePresentInElement(By locator,
String text)
已过时。
|
static ExpectedCondition<Boolean> |
ExpectedConditions.textToBePresentInElementLocated(By locator,
String text)
An expectation for checking if the given text is present in the element that matches the given
locator.
|
static ExpectedCondition<Boolean> |
ExpectedConditions.textToBePresentInElementValue(By locator,
String text)
An expectation for checking if the given text is present in the specified elements value
attribute.
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.visibilityOfAllElementsLocatedBy(By locator)
An expectation for checking that all elements present on the web page that match the locator
are visible.
|
static ExpectedCondition<WebElement> |
ExpectedConditions.visibilityOfElementLocated(By locator)
An expectation for checking that an element is present on the DOM of a page and visible.
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.visibilityOfNestedElementsLocatedBy(By locator,
By sub_locator)
An expectation for checking child WebElement as a part of parent element to be visible
|
static ExpectedCondition<List<WebElement>> |
ExpectedConditions.visibilityOfNestedElementsLocatedBy(WebElement element,
By sub_locator)
An expectation for checking child WebElement as a part of parent element to be visible
|