group-icon
Software Testing Squad
All About Software Testing In One Place!
131 Members
Join this group to post and comment.
Shruthi Pillai
Shruthi Pillai
Information Technology
01 Feb 2019

Xpath in selenium

Xpath is used to locate a web element based on its XML path. It stores data in a key-value pair  . XPath can be used to locate HTML elements. 

The fundamental behind locating elements using XPath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.


Radhika Deshpande
Radhika Deshpande
Computer Science
3mos ago

Xpath is syntax for finding any element on web page with xml expression .e location of the element in the DOM file.


The syntax of xpath is -


//------------------ 
... 
Xpath=//tagname[@attribute='value']
... 
//------------------ 

Where -

  1. // : Select current node.
  2. Tagname: Tagname of the particular node.
  3. @: Select attribute.
  4. Attribute: Attribute name of the node.
  5. Value: Value of the attribute.

Archana Priyadarshini
Archana Priyadarshini
Computer Science
3mos ago

XPath is nothing but the XML Path. It helps in locating any element on a web page that uses traditional XML path expression. XPath uses HTML DOM structure that looks like XML path expression.