Element

This class provides a way to get hokld of Seleniums WebElements.

Classes

Element

Methods

(async) find(selector, optionsopt) → {Promise.<WebElement>}

Finds an element using a CSS selector, with optional waiting and visibility check.
Parameters:
NameTypeAttributesDescription
selectorstringThe CSS selector of the element.
optionsObject<optional>
Options for finding the element.
Properties
NameTypeAttributesDefaultDescription
timeoutnumber<optional>
Maximum time in milliseconds to wait for the element. Defaults to the configured --timeouts.elementWait value.
visibleboolean<optional>
falseIf true, waits for the element to be visible, not just present.
Throws:
Throws an error if the element is not found within the timeout.
Type
Error
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>

(async) getByClassName(className) → {Promise.<WebElement>}

Finds an element by its class name.
Parameters:
NameTypeDescription
classNamestringThe class name of the element.
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>

(async) getByCss(name) → {Promise.<WebElement>}

Finds an element by its CSS selector.
Parameters:
NameTypeDescription
namestringThe CSS selector of the element.
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>

(async) getById(id) → {Promise.<WebElement>}

Finds an element by its ID.
Parameters:
NameTypeDescription
idstringThe ID of the element.
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>

(async) getByName(name) → {Promise.<WebElement>}

Finds an element by its name attribute.
Parameters:
NameTypeDescription
namestringThe name attribute of the element.
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>

(async) getByXpath(xpath) → {Promise.<WebElement>}

Finds an element by its XPath.
Parameters:
NameTypeDescription
xpathstringThe XPath query of the element.
Returns:
A promise that resolves to the WebElement found.
Type: 
Promise.<WebElement>