How can we define which Web GUI locator we should use for achieving static automation?
A locator is the combination of the type and the value of the By clause. It helps locate the GUI elements through which multiple user actions can be performed.
To Choose the Best Locators following points should be considered:
- The locator must match the desired element
2.The locator must not match any other element
- Avoid depending on information that is likely to change
- Depend on the minimal necessary information
There is no fixed way to define which locator to use. Generally ID`s are commonly used .ID’s are unique to elements and hence are considered as the fastest and safest method to locate element.