Locating by attributes
This is probably the most common method of locating elements and is the catch-all default when no recognized locator type is used. With this strategy, the first element with the id attribute value matching the location will be used. If no element has a matching id attribute, then the first element with a name attribute matching the location will be used.
For instance, your page source could have id and name attributes as follows:
1 2 3 4 5 6 7 8 9
The following locator strategies would return the elements from the HTML snippet above indicated by line number:
- identifier=loginForm (3)
- identifier=password (5)
- identifier=continue (6)
- continue (6)
Since the identifier type of locator is the default, the identifier= in the first three examples above is not necessary.