Link Search Menu Expand Document

Locators

The locators are supplied as a string prefixed with the locator types as shown in the table below.

TypeLocator
idfind("id:some_id")
namefind("name:some_name")
classfind("class:some_class")
tag namefind("tagName:some_tag_name")
xpathfind("//xpath")
css selectorfind("css: css selector”)
link textfind("linkText:link text”)
partial link textfind("partialLinkText:partial link text”)

To locate an element by its title

TypeLocator
titlefind("title:title value")

To locate an element by its text value

TypeLocator
textfind("text value")

Special Xpath functions


For simple xpath expressions you can just type it in natural English. For example //div[name='user_name'] can be passed over to the framework like find("div with name user_name")

If it is a partial match you can use find("div contains name user")

If the property contains special characters or white spaces, you can enclose them in single quotes find("div contains text 'User Login'")

For a comprehensive x-path reference, refer this link
For CSS selectors, refer this link