It is to identify the elements with tag names
It is of two types
1)relative x path
2) Absolute x path
1) Relative x path:-
we can identify the elements with the help of a parent tag and with unique attributes.
In attributes, we can provide multiple also to identify the element.
Ex:-//input [@id=’id’]
ath=input[@id=’f-id’]
//input [@id=’f-id’ and @name=’name’]
Interested in mastering Selenium Training? Enroll now for FREE demo on Selenium Training.
2) Absolute xpath:---
By using relative XPath if we are unable to identify the element then we can go the absolute path
It will identify the element with the complete hierarchal XML path of the element.
we can take the absolute XPath from the tool fire path.It is an add on for firebug.
Firefoxfirebugfirepath
Launch Firefox and open below url
http://addons.mozilla.org/en.us/firefox/addon/firepath/
Go to the above path click on “add to Firefox”
install now
How to capture xpath:-
Right-click on the element click on inspect else with firebug and then click on the tagitive element and then click on inspect in the fire path
By default, it generates relative x path
To get the absolute XPath àclick on arrow mark at fire pathàselect general XPath
Done firebug and capture the xpath again to get the absolute XPath
Note:-XPath should always start with “//”(or)”xpath=”
Learn more about Selenium Interview Questions in this blog post.
DOM(document object model):-
This approach is derived from javascript
It will identify the elements based on the form name.
Syntax:-
Selenium.type(“document.formignaiverity.f-id”,”jaridselenim”);
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.