The most common attribute key names are class and id, where id has to be unique over the entire HTML page (according to the HTML specification). This locator strategy allows Selenium WebDriver to find that unique element and perform some action against it.
<input id="username" type="text" />
We can use one of the following locators:
If we want to be more explicit we can write:
Using the latter we explicitly mention the type of element.
Examine your knowledge and play the ‘locator game‘.