Hey there! any question in your mind? Ask It Now!.

Popular Categories

What is XPATH

+2 votes
asked in Automation Testing Interview Question by tester (1,550 points)
edited by Bhartesh
What is XPATH ? How to define it ? is it based on some language ?

Please explain with an example, how to create it and for which languages we can use it ?

Thanks in advance!

1 Answer

0 votes
answered by smarttester (590 points)

XPath (XML Path Language) is a query language in which we can select nodes and nodes values from an XML, It also can be used for some string value or Boolean values.

In a simple way XPath is a simple address of an item in XML, Almost all browsers supports XPaths as XHTML doc. It is basically based on a tree representation to navigating and search nodes in the DOM.

Xpath Eg:

<?xml version="1.0" encoding="utf-8"?>
   <project name="New Project" launch="2015-01-08">
       <edition language="English">Xpath test</edition>

How to use expressions :

/xmltag/projects/project/@name    (Selects name attributes for all projects)

/xmltag/projects/project/editions    (Selects all editions of project)  Etc…

For XHTML or HTML XPath please refer XPath for HTML Elements a good explanation of XPath creation and use.

Related Questions

+1 vote
1 answer 4,621 views
0 votes
1 answer 75 views
+4 votes
3 answers 233 views
+7 votes
1 answer 564 views

Not a Member yet?

Ask to Folks Login

My Account
343 Folks are online
2 members and 341 guest online
Your feedback is highly appreciated