A locator in Selenium is a means of identifying an element for the selenium command. Usually it is the target part of the command. Did you know that when recording with the Selenium IDE, sometimes the target textbox changes into a dropdown list? Go ahead and try it out.
- Start the Selenium IDE.
- Go to the http://seleniumhq.org/ page.
- Right-click on the first point saying “Begin: write and run tests in Firefox”.
- Then choose Show All Available Commands and then VerifyText Step1 1. Begin: write and …
- In the IDE, click on the VerifyText command just recorded and you will see the target textbox change to a dropdown list.
- Open the dropdown list to see all the available locators.
This is often a powerful tool to select alternate locators for elements in your Selenium commands. It can also be a training tool to learn new ways of selecting elements when you are still trying to learn XPATH and CSS selectors.