Sunday, 1 May 2016

How to locate Web Elements in Your Web Applications ?

Locating elements is the first step of starting automation. Locating element means going through HTML code of an website and finding unique data like id, class name etc but most effective way to locate elements ais Xpath. We will see in details how to write xpath soon.  In this post any reference to elements means web elements like button, text box, text field, drop down, menu bars etc.

First of all you need to check HTML code so that you can select unique attribute and value to locate the elements. Let us see how to get the HTML code withe Firebug plugin in Firefox browser or Chrome browser. It is very easy and effective method.

Video Tutorial -

Checking HTML code using Firebug -
1. Once you install FireFox plugin in the FireFox / Chrome browser
2. You will see a bug icon in your browser tool bar when you click on it, you will see a window opens up at botton of the page with HTML code

3. To inspect element click on the blue icon with arrow on right side as shown in below screen shot.

4.  Then mouse over on the menu item and check the highlighted HTML code for that Web Element.

5. You can right click on the HTML line of code and click on copy XPath to find the Xpath. But my advice is to write your own xpath which will be more consistent while running your test cases.

Once you can get HTML code for Web Elements you can locate elements using attributes and values right away inside your Selenium WebDriver Test cases. Do read the Next Post to find out How to write Xpath to Locate Web Elements.


  1. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    Webdesining course in chennai

  2. Nice blog..! I really loved reading through this article. Thanks for sharing such a
    amazing post with us and keep blogging... best angularjs training institute in chennai | angularjs training in omr | angular 4 training in chennai | angularjs training in omr

  3. Write My Essays is an online essay writing service dedicated to delivering high-quality academic writing to students across the English-speaking world.


  4. This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
    AWS training in Noida

  5. All pieces of information are very useful for those students who are getting training for becoming a developer. I appreciate your efforts to introduce new applications which are very important for developing a new business website
    dissertation writing service

  6. Hmm, my brother is interested in these things – he is a computer freak. I will share this post with him, and leave – because honestly, I don’t understand this technical stuff. I am better off going to Cheap Essay Writer - and ordering my essay as I am already late on it. Anyway, I hope my brother likes this post.