What are locators and how are they used?
DOM locators are used to find a specific element on a web page.
Steps and checks use locators to find the correct element to interact with. Usetrace uses multiple locators. An element is found when at least one of its locators match the current web page.
Editor retrieves element attributes like name, id, name, xpath, relative xpath and also css when steps and checks are created.
These attributes can then be used for the step or check to find the element one after another until the element is found.
In Editor, click the locator tab on the desired step to change the locator attributes for a step or a check. Note that the locators are checked in the order they appear.
The supported locators are:
id - the html element’s id
name - the html element’s name
xpath - an absolute or relative xpath to the element
css - a css selector locating the element
link text - in case of links (anchor tags), the unique text identifying the link
text equals - the html element’s text
text contain - the html element’s text contains
The locator is used only in case it uniquely identifies the element. If you define a loose locator, for example, a css selector “button”, Usetrace will probably find multiple html elements matching the locator. In that case, Usetrace will not interact with the site. To resolve this, define a more strict locator using some unique attribute, e.g. a css class.