• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Xpath in Selenium

Implementation of Xpath in Selenium

2It is to identify the elements  with tag names

2It is of two types

1)relative x path

2) Absolute x path

1) Relative x path:-

2we can identify the elements  with the help of parent tag and with unique attributes.

2In 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:—

2By using relative xpath if we are unable identify the element then we can go absolute path

2It will identify the element with the complete  hierarchal xml path of the element.

2we can take the absolute xpath from the tool fire path .It is an  add on for firebug.

Firefox2firebug2firepath

2Launch  Firefox and open below url

http://addons.mozilla.org/en.us/firefox/addon/firepath/

2Go to the above path click on “add to Firefox”

2install now

How to capture xpath:-

2Right click on the element click on inspect else with firebug and then click on the tagitive element and then click on inspect in fire path

2By default it generates relative x path

2To got the absolute xpath àclick on arrow mark at fire pathàselect general xpath

2Done fire bug and capture the xpath again to get the absolute xpath

Note:-xpath should always starts with “//”(or)”xpath=”

Learn more about Selenium Interview Questions in this blog post.

DOM(document  object model):-

2This approach is derived from java script

2It will identify the elements based on the form name.

Syntax:-

Selenium.type(“document.formignaiverity.f-id”,”jaridselenim”);

For an Indepth knowledge on Selenium, click on below

Summary
Review Date
Reviewed Item
Xpath in Selenium
Author Rating
4

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Xpath in Selenium"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.