Locating web page elements is one of the most crucial tasks of automation activities. Sure you can create locators manually or use Selenium IDE to get details of these element locators. However, wouldn’t it be nice if you can get element locator details in your browser’s context menu itself? Enter WebDriver Element Locator. A nifty add-on for Firefox browser which lets you do just that.
To use this add-on, right click on the web page element you want to locate. It would show multiple options of element locators in your browser’s context menu. You can get C#, Java, Support, Python and Ruby locators using this add-on. Along with all these, you can also get details of XPath as well. See below screenshot to see WebDriver Element Locator in action.
Below are some salient features of this add-on.
- To prevent buggy tests, it checks locators for uniqueness.
- It signifies locator uniqueness using red cross and green tick. Making it easy for users to choose relevant locator.
- If locating via attributes is difficult, it also attempts to locate via text value.
- In case of long attribute names, it attempts to locate based on the final (and most significant) part of the value only.
If you want to disable any locator type(Eg. Ruby) in context menu, follow below steps.
- Go to Tools–>Add-ons.
- Select Options button of this add-on.
- Uncheck locators you don’t need and click Disable button.
You can also change the name of your WebDriver instance by performing above steps.
All in all, a nice and very useful add-on to have for automation testing. Give it a try and let us know what do you think of it.