Using Attributes to Identify an Object

To identify an object based on its properties, you can use locator attributes. The locator attributes are specified in square brackets after the type of the object.

Example

The following sample uses the textContents attribute to identify a hyperlink with the text Home. If there are multiple hyperlinks with the same text, the locator identifies the first one.

DomLink link = browserWindow.<DomLink>find(//a[@textContents='Home']");