Skip to main content

Function: byAttribute()

byAttribute(name, value, relativeTo): CssLocator

Defined in: packages/core/src/locators/byAttribute.ts:25

Locate an element by a specific attribute and value.

Parameters​

name​

string

The attribute name.

value​

string

The attribute value to match.

relativeTo​

LocatorRelativePosition = 'Descendant'

Relative position of the locator. Defaults to 'Descendant'.

Returns​

CssLocator

Example​

const dialog = byAttribute('role', 'dialog');