Google+

XPath Helper plugin - Using this plugin in Selenium for locating the GUI elements in Chrome browser

So far, we have used the below Firefox Add ons / Plug-ins for locating the GUI elements on the Web Pages:

  • Firebug
  • Firepath
  • WebDriver Element locator
  • Selenium IDE

Though we can use the Plug-ins for Firefox browser to locate the GUI elements on the web-pages, but if you are a Chrome lover and want to locate the GUI elements on the Web Pages from a Chrome browser, then XPath Helper Plug-in is going to make your day. i.e. XPath Helper Plug-in is the chrome browser plug-in for locating the GUI elements on the web pages.



Using XPath Helper Chrome browser Plug-in, we can perform any of the below:

  • Generate XPath locators for GUI elements on the web pages
  • Validating the manually written XPath locator, to check whether it is locating the specific GUI elements on the web pages.

Note: Absolute XPath locator will be generated by 'XPath Helper' chrome plug-in for the selected GUI element on the web page. In order to generate relative XPath, we need to use a different chrome plugin. I will explain relative XPath generation plugin for chrome browser in a different post.


Practical Usage of XPath Helper Chrome Browser Plug-in

Lets follow the below steps to practically find out how a XPath Helper Chrome browser Plug-in can do the above:

Installing XPath Helper Chrome Browser Plug-in

Lets follow the below steps for installing the XPath Helper Chrome Browser Plug-in:

1. Launch Chrome browser as shown below:



2. Google Search for "XPath Helper Chrome Plug-in" from the chrome browser as shown below:



3. Click on the below market link from the displayed search results:



4. 'XPath Helper' details will be displayed in the chrome web store and click on 'ADD TO CHROME' button as shown below:



5. Click 'Add extension' on the displayed Pop-up dialog as shown below:



6. XPath Helper plug-in will be installed and added to the chrome browser as extension as shown below:



Generating XPath locators for GUI elements on web pages using XPath Helper Plug-in

Lets follow the below steps for generating XPath locators for GUI elements on the web pages

7. Navigate to the application under test for which you want to locate the GUI elements on the web page, (say navigate to sample application say www.omayo.blogspot.com ):



8. Lets generate the absolute XPath locator for the below shown 'Selenium143' GUI element link on the web page using 'XPath Helper' Chrome browser plug-in:



9. Now, click on earlier installed and added 'XPath Helper' Chrome extension on the Chrome browser as shown below:



10. 'Query' and 'RESULTS' pane of  'XPath Helper' will be displayed as shown below:



11. Press and hold the 'Shift' button on the keyboard and move your mouse cursor over any GUI elements say 'Selenium143' link as shown below:



12. On performing the above Step 11, absolute XPath will be displayed in the 'Query' section of 'XPath Helper' pane as shown below:



13. Also, the GUI element details related to the displayed Absolute XPath, will be displayed in the 'Results' section of 'XPath Helper' as shown below:



Validating the manually written XPath locator, to check whether it is locating the specific GUI elements on the web pages.

Lets follow the below steps for validating the manually written XPath locators for GUI elements on the web pages

14. Lets say, I have manually wrote XPath locator for 'Selenium143' link on the Web Page as '//a[@id='link1']' and would like to validate whether this XPath locator is able to locate the required GUI element.

15. Manually write the XPath locator say '//a[@id='link1']' into the 'Query' pane of  'XPath Helper' as shown below:



16. Validate the XPath locator specified by QUERY section, by checking whether the required GUI element details got displayed in the 'RESULTS' section as shown below:



Conclusion

Hence if you are a Chrome lover and want to locate the GUI elements on the Web Pages from a Chrome browser, then XPath Helper Chrome browser Plug-in is the best choice.

XPath Helper Plug-in can be used to auto generate absolute XPath for the required GUI element and also can be used to validate the manually provided XPath, to check whether the manually provided XPath is locating the required GUI elements on the page. 

2 comments:

Pradeep Koulagi said...

Very good article. Please keep posting

Arun Motoori said...

@Pradeep - Thank you very much :)