This is a most important article for every reader as how to use xpath checker for Firefox. I know you all are excited about selenium webdriver script.
Xpath checker for Firefox
Firefox is a default browser for selenium webdriver, selenium supported to Firefox officially.
Right now there are lots of questions came in to your mind, what is xpath? how to generate xpath using xpath checker and what actually xpath checker?
I can describe all the answers of your questions one by one, so you will get more clarify on the same.
Open Firefox browser
Open the Firefox browser and enter URL as www.google.com, Google website is loaded in browsers.
We want to search exact HTML tag and attributes for Google search text box.
Right click on Google site >> select View Page Source
See all HTML code is displayed on View Page Source screen
Friends, here you cannot search easily HTML for Google search text box in this huge HTML code
That’s why, the Firefox introduced tool for xpath checker and it helps to simple search and save your time.
You have to download two add-on tools as Firebug and Firepath from Firefox authorized site.
Firebug
Download firebug tool from below URL
https://addons.mozilla.org/en-US/firefox/addon/firebug
Firepath
Download firepath tool from below URL
https://addons.mozilla.org/en-US/firefox/addon/firepath
Also Read: Know more about selenium webdriver
Downloaded
Confirm that both tool downloaded successfully on your local drive as per selected path.
Open the Firefox browser and check Firebug and Firepath tools are added successfully
Firebug icon is added on top menu bar in the browser.
Press F12 check firepath functionality icon is added.
Keep the cursor on Google search text box and click on Firepath icon
See Xpath is auto populated.
HTML
You can learn some basic HTML knowledge to search exact HTML code for the selected WebElement
Getting confuse!! We don’t require complete HTML knowledge, as we will search only three things around the selected WebElement
- Tag
- Attribute
- Value
You need to understand above three things from the HTML code to search correct xpath, the script writing gets easy once you familiar with search xpath, also I will teach you how to make xpath manually instead of given readymade xpath through the xpath checker for firefox.
In this article you have seen how we have downloaded firebug and firepath and added in firefox browser.
Also we have seen xpath is pre-populated for the selected WebElement when click on firepath and move mouse cursor to WebElement.
Xpath is very popular locator strategy to perform the operation regarding WebElement.
This is how xpath checker for firefox, same thing I will describe for Google chrome in the next article on testingnotes, so you can do the scripting for both browsers trust me this very small change in your script for browser selection specific.
Also I will describe about your first selenium script in the next article.