ad

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.

47 comments:

  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

    ReplyDelete
  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: https://community.hpe.com/t5/All-About-the-Apps/Using-Selenium-for-Web-Automation-Let-UFT-Pro-LeanFT-help-you/ba-p/6932523#.WKI5UVUrK0k

    ReplyDelete
  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

    ReplyDelete
  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 info@bravetechnologies.in. ERP Providers in Chennai

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  20. DevOps Training in Chennai

    I am glad that I have visited this blog. Really helpful, eagerly waiting for more updates.

    ReplyDelete
  21. Really i found this article more informative, thanks for sharing this article! Also Check here

    Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows

    Vidmate App Download

    Vidmate apk for Android devices

    Vidmate App

    download Vidmate for Windows PC

    download Vidmate for Windows PC Free

    Vidmate Download for Windows 10

    Download Vidmate for iOS

    Download Vidmate for Blackberry

    Vidmate For IOS and Blackberry OS

    ReplyDelete
  22. Lucky Patcher Apk
    Lucky Patcher
    Lucky Patcher App
    How to Use Lucky Patcher App
    How to Use Lucky Patcher Apk


    Lucky Patcher smile could be a must-have hacking app for all the crazy gamers.
    This app helps in modifying most of the android games so the games will be enjoyed to the fullest.
    It additionally lets us modify numerous applications in many ways Lucky Patcher Download.
    Lucky Patcher smileis an incredible tool that permits you to block advertisements, take away system apps, modify system apps, bypass license verification, modify app permissions, and for a lot of.

    ReplyDelete
  23. keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
    digital marketing training in bangalore | https://www.excelr.com/digital-marketing-training-in-bangalore

    ReplyDelete
  24. Excellent blog. Your blog gives lots of information, keep up the good work and share more.

    ReplyDelete
  25. Thanks for the useful post. Keep posting more like this.

    ReplyDelete
  26. Thanks for the points shared in your blog. One more thing I would like to talk about is that fat reduction is not information about going on a celebrity diet and trying to shed as much weight as you can in a couple of weeks.The most effective way to lose weight is by getting it bit by bit and right after some basic recommendations which can help you to make the most from your attempt to shed weight. You may understand and be following some of these tips, although reinforcing information never damages. Mahapolice , Majhi naukri, Govnokri, Mpsc world, NMK, Jobchjob, Freshersvoice, Pavitra Portal, Mahavitaran, Mahakosh, Msrtc exam, Mahapariksha, Mahapolice, Mahakosh, Ongc Recruitment, Free Job Alert.

    ReplyDelete
  27. Python Training in Chennaii

    Excellent blog with lots of information. I have to thank for this. Do share more.

    ReplyDelete
  28. Top Technologies to learn

    I am glad that I have visited this blog. Really helpful, eagerly waiting for more updates.

    ReplyDelete
  29. Top Technologies to learn

    I am glad that I have visited this blog. Really helpful, eagerly waiting for more updates.

    ReplyDelete