Sunday, March 27, 2016

Selenium WebDriver: Tools to identify Locators easily

When automating a web application, the most important and time taking task is to come up with unique locators for the elements present on the web page. Once you find out the correct locator, the rest of the automation is relatively easier.
Finding correct and unique locators require human intelligence and below tools can help you in a great deal when you start creating your scripts. Every automation engineer should have these tools in their arsenal.

List of Tools to identify Locators

Firebug  (Firefox addon)
The favourite tool of web developers. Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. Its console window and inspection tool are the best available in the market.

Firefinder for Firebug
This tool is simple, provide any XPath or CSS selector and it will highlight the matching elements on the web. Simple, lightweight and easy to use. Install it on top of Firebug.

FirePath for Firebug
Right Click on any element and select "Inspect in Firepath", this addon will generate the XPath or CSS selector for you. It also highlights the element on the web page and in the DOM. Very useful. Again install it on top of Firebug.

WebDriver Element Locator (Firefox addon)
This addon will generate XPath for any given element. But the best thing is, it will also generate WebDriver statements for you and also in the language of your choice. Currently, it supports C#, Java, Python and Ruby.  Just right-click on any element and generate the code in your favourite language. It is that simple. The only downside is that it only generates XPath.

Selector Detector (Bookmarklet)
Sometimes XPath and CSS Selectors do not work in a given situation. That's where JQuery selector comes in handy. This is a bookmarklet created by Jessie A. Morris and it will generate the jQuery selector for your on the clicked element. Go to this link and drag the provided bookmarklet to your bookmarks bar. The button will appear with the name Selector Detector. Now click on it and Click on any element and it will generate the jQuery selector for you.

SelectorGadget (Bookmarklet and Chrome Extension)
This tool is created by Andrew Cantino and Kyle Maxwell. It can generate CSS Selectors for you. Authors describe the method to generate CSS selector like this.
Click on a page element that you would like your selector to match (it will turn green). SelectorGadget will then generate a minimal CSS selector for that element, and will highlight (yellow) everything that is matched by the selector. Now click on a highlighted element to remove it from the selector (red), or click on an unhighlighted element to add it to the selector. Through this process of selection and rejection, SelectorGadget helps you come up with the Perfect CSS selector for your needs.
See the video on the provided link to better understand this tool.

SWD Page Recorder (.Net Application)
This is a comprehensive tool and it is more than just a generator. It is developed by Dmitry Zhariy. Using this tool, you can generate selectors as well as full classes for your code in Selenium WebDriver. It allows you to generate Page Object Models for your automation code. If you are a C# developer, this tool will save you ample amount of time. The best thing about this tool that you can write C# code in this tool and see the live results on the browser. That is amazing.

Looking Glass (Java Application)
Although not as comprehensive as SWD Page Recorder, This tool is still useful in finding elements. It also allows you to write groovy scripts and see the results live on the browser. Good for Java developers.

These were some of the tools to identify locators easily. I hope the above list helps the automation engineers in saving their time to identify and verify element locators. I am also working on an application inspired by Looking Glass and SWD page recorder. It will allow you to verify your locators and generate C# classes for you. I am calling it "SeleniumVerify". It is present on GitHub. Currently it is under development and I will soon update you when it is ready for download.
Do you happen to know any other tools. Please share in comment and also give your feedback on this article.


  1. Thanks for your post; selenium is most trusted automation tool to validate web application and browser. This tool provides precise and complete information about a software application or environment. Selenium Training in Chennai | Selenium Course in Chennai | Best Selenium training institute in Chennai

  2. There is another player in the block, called LeanFT for Selenium, that is doing much more than just Locators identification, or easily creating the unique identification code for you.
    If you didn't hear about LeanFT yet and want to learn how it boost the ROI you get from Selenium, this blog will be just for you:

  3. I have read your blog its very Interesting. Thanks for sharing. Call for low cost ERP software. ERP in Chennai | ERP Software in Chennai

  4. Thank you for this valuable information. I have got some important suggestions from it. I'm working in Brave Technologies Private Limited. We provides lowest price of ERP Software for our clients. Contact us on ERP Providers in Chennai

  5. Really, these quotes are the holistic approach toward mindfulness. In fact, all of your posts are. Proudly saying I’m getting fruitfulness out of what you write and share. Thank you so much
    Digital marketing course in chennai

  6. Thanks for the useful post. Keep posting more like this.
    Webdesign Lüdenscheid

  7. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

  8. I found a lot of interesting information here. A really good post
    WebDesign Lüdenscheid

  9. Excellent blog. Your blog gives lots of information, keep up the good work and share more.
    Digital Marketing Course in Chennai
    Digital Marketing Course

  10. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.

    Selenium Training in Chennai

    Selenium Training in Bangalore

  11. The main thing which I like about selenium is that it needs creativity and we need to work differently according to our clients need.
    B.Com Project Center in Chennai | B.Com Project Center in Velachery

  12. This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. ToolsDuty

  13. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    regionale stellenbörse

  14. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.

    software testing course in chennai

  15. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    arguments against big bang theory

  16. Great one,You have done a great job by sharing this content,Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    Python Training in Chennai
    Python Training

  17. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    ccna Training center in Chennai
    Best CCNA Training Institute in Chennai
    ccna certification in Chennai
    ccna course in Chennai
    German Language Course in Chennai
    German Courses in Chennai

  18. I read your blog regularly from the beginning. It was very impressed to me and I learn huge of information from your blog. Thank you!!!
    Ethical Hacking Course in Chennai
    Hacking Course in Chennai
    Certified Ethical Hacking Course in Chennai
    Ethical Hacking Training in Chennai

  19. Thank you the wonderful ideas that you have shared with us.i enjoyed your ideas and the way of you gave the informations.
    IOS Training in Chennai
    ios training in velachery