Describes a mechanism for locating an element on the page.
| Name | Type | Description |
|---|---|---|
using | string | the name of the location strategy to use. |
value | string | the value to search for. |
Locates elements that have a specific class name.
| Name | Type | Description |
|---|---|---|
name | string | The class name to search for. |
The new locator.
Locates elements using a CSS selector.
| Name | Type | Description |
|---|---|---|
selector | string | The CSS selector to use. |
The new locator.
Locates elements by the ID attribute. This locator uses the CSS selector*[id="$ID"],notdocument.getElementById.
| Name | Type | Description |
|---|---|---|
id | string | The ID to search for. |
The new locator.
Locates elements by evaluating ascript that defines the body of a JavaScript function. The return value of this function must be an element or an array-like list of elements. When this locator returns a list of elements, but only one is expected, the first element in this list will be used as the single element value.
| Name | Type | Attributes | Description |
|---|---|---|---|
script | string | | The script to execute. | |
var_args | * | <repeatable> | The arguments to pass to the script. |
Locates link elements whose visible text matches the given string.
| Name | Type | Description |
|---|---|---|
text | string | The link text to search for. |
The new locator.
Locates elements whosename attribute has the given value.
| Name | Type | Description |
|---|---|---|
name | string | The name attribute to search for. |
The new locator.
Locates link elements whose visible text contains the given substring.
| Name | Type | Description |
|---|---|---|
text | string | The substring to check for in a link's visible text. |
The new locator.
Locates elements with a given tag name.
| Name | Type | Description |
|---|---|---|
name | string | The tag name to search for. |
The new locator.
Locates elements matching a XPath selector. Care should be taken when using an XPath selector with a webdriver.WebElement as WebDriver will respect the context in the specified in the selector. For example, given the selector//div, WebDriver will search from the document root regardless of whether the locator was used with a WebElement.
| Name | Type | Description |
|---|---|---|
xpath | string | The XPath selector to use. |
The new locator.