SlideShare a Scribd company logo
Presentation on XPATH
© Sun Technologies Inc. 1
WHAT IS XPATH ?
•XPath is normally called as XML Path
•XPath is the one of the way to locate elements on
webpage.
•XPath uses path expressions to select element in an
HTML document.
•XPath contains a library of standard functions
© Sun Technologies Inc. 2
XPath Syntax
• XPath uses path expressions to select nodes in an XML document.
The node is selected by following steps.
© Sun Technologies Inc. 3
Expression Description
nodename Selects all nodes with the name "nodename"
/ Selects from the root node
// Selects nodes in the document from the current node that
match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes
Xpath Ways
• Xpath can be created in two ways:
• Absolute Xpath
Absolute Xpath begins with a root path and is prefixed with a “/”.
• Relative Xpath
Relative Xpath begins from the current location and is prefixed with
a “//”.
© Sun Technologies Inc. 4
XPath Axes
An axis defines a node-set relative to the current node.
© Sun Technologies Inc. 5
•ancestor
•ancestor-or-self
•attribute
•child
•descendant
•descendant-or-self
•following
•following-sibling
•namespace
•parent
•preceding
•preceding-sibling
•self
Selecting Unknown Nodes
• XPath wildcards can be used to select unknown XML nodes.
© Sun Technologies Inc. 6
Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind
XPath functions
XPath contains a number of functions on node sets, numbers, and strings;
here are a few of them:
• Contains: contains(arg1, arg2) tests if arg1 contains arg2
Example://img[contains(@src,’Profile’)]
• starts-with: starts-with(arg1, arg2) tests if arg1 starts with arg2
Example: //*[starts-with(name(), 'sec']
• ends-with: ends-with(arg1, arg2) tests if arg1 ends with arg2
Example: //*[ends-with(name(), ‘details']
© Sun Technologies Inc. 7

More Related Content

PPT
PPTX
Php.ppt
PPTX
Form using html and java script validation
PPT
PPT
How Cascading Style Sheets (CSS) Works
PPTX
Java script errors & exceptions handling
PPTX
Flex box
PPT
Java Script ppt
Php.ppt
Form using html and java script validation
How Cascading Style Sheets (CSS) Works
Java script errors & exceptions handling
Flex box
Java Script ppt

What's hot (20)

PPTX
html-table
PPSX
Javascript variables and datatypes
PPT
PHP - Introduction to PHP Forms
PDF
HTML CSS JS in Nut shell
PDF
Xml schema
PPTX
CSS - Text Properties
PDF
Bootstrap 5 basic
PDF
Querying XML: XPath and XQuery
PPT
CSS Basics
PPTX
Spring Boot Tutorial
PPTX
Bootstrap PPT Part - 2
PPT
L11 array list
PDF
Java IO
PDF
Flask for cs students
PDF
Javascript basics
PDF
Introduction to Bootstrap
PPTX
ODP
CSS Basics
PPT
html-table
Javascript variables and datatypes
PHP - Introduction to PHP Forms
HTML CSS JS in Nut shell
Xml schema
CSS - Text Properties
Bootstrap 5 basic
Querying XML: XPath and XQuery
CSS Basics
Spring Boot Tutorial
Bootstrap PPT Part - 2
L11 array list
Java IO
Flask for cs students
Javascript basics
Introduction to Bootstrap
CSS Basics
Ad

Viewers also liked (20)

PPTX
Selenium web driver
PPTX
PPTX
Maven and ANT
PPTX
Path Testing
PPT
Selenium
PPTX
PPTX
Silk Performer Presentation v1
PDF
Javascript Test Automation Workshop (21.08.2014)
PPTX
Browser Automated Testing Frameworks - Nightwatch.js
PPT
Selenium
PPT
Software testing
PPTX
Javascript
PPTX
Mobile Application Testing
PPTX
Introduction to Selenium Web Driver
PPT
Web Test Automation with Selenium
PPTX
HTML, CSS and Java Scripts Basics
PDF
Introduction
PDF
XMPP - Introduction And LAS Implementation (Presentation)
PPT
PPTX
Severity и Priority для неначинающих: очевидное и невероятное
Selenium web driver
Maven and ANT
Path Testing
Selenium
Silk Performer Presentation v1
Javascript Test Automation Workshop (21.08.2014)
Browser Automated Testing Frameworks - Nightwatch.js
Selenium
Software testing
Javascript
Mobile Application Testing
Introduction to Selenium Web Driver
Web Test Automation with Selenium
HTML, CSS and Java Scripts Basics
Introduction
XMPP - Introduction And LAS Implementation (Presentation)
Severity и Priority для неначинающих: очевидное и невероятное
Ad

Similar to XPATH (20)

PDF
Day2 xslt x_path_xquery
PDF
Xpath.pdf
PDF
A brief overview of XPath - Topic in XML - Web Technologies
DOC
PPTX
XML Technologies
PDF
26xslt
PPTX
Xml query language and navigation
PDF
02_Xpath.pdf
PPT
PPT
03 x files
PDF
Implementing a Distributed Hash Table with Scala and Akka
PPTX
Attack monitoring using ElasticSearch Logstash and Kibana
PPTX
XML Pipelines
PPTX
X path
PPTX
X path
PPTX
Scrapy.for.dummies
PPT
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
PPT
PPTX
Selenium-Locators
Day2 xslt x_path_xquery
Xpath.pdf
A brief overview of XPath - Topic in XML - Web Technologies
XML Technologies
26xslt
Xml query language and navigation
02_Xpath.pdf
03 x files
Implementing a Distributed Hash Table with Scala and Akka
Attack monitoring using ElasticSearch Logstash and Kibana
XML Pipelines
X path
X path
Scrapy.for.dummies
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
Selenium-Locators

More from Sun Technlogies (9)

PPTX
HyperText Markup Language - HTML
PPTX
Extended Finite State Machine - EFSM
PPTX
Cascading Style Sheets - CSS
PPTX
Core java
PPTX
Automation Testing
PPTX
PPTX
PPTX
Array and functions
PPTX
HyperText Markup Language - HTML
Extended Finite State Machine - EFSM
Cascading Style Sheets - CSS
Core java
Automation Testing
Array and functions

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
medical staffing services at VALiNTRY
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
AI in Product Development-omnex systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPT
Introduction Database Management System for Course Database
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
L1 - Introduction to python Backend.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
medical staffing services at VALiNTRY
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Odoo Companies in India – Driving Business Transformation.pdf
Digital Strategies for Manufacturing Companies
Navsoft: AI-Powered Business Solutions & Custom Software Development
AI in Product Development-omnex systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Operating system designcfffgfgggggggvggggggggg
ManageIQ - Sprint 268 Review - Slide Deck
Introduction Database Management System for Course Database
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Which alternative to Crystal Reports is best for small or large businesses.pdf
ISO 45001 Occupational Health and Safety Management System
VVF-Customer-Presentation2025-Ver1.9.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
L1 - Introduction to python Backend.pptx

XPATH

  • 1. Presentation on XPATH © Sun Technologies Inc. 1
  • 2. WHAT IS XPATH ? •XPath is normally called as XML Path •XPath is the one of the way to locate elements on webpage. •XPath uses path expressions to select element in an HTML document. •XPath contains a library of standard functions © Sun Technologies Inc. 2
  • 3. XPath Syntax • XPath uses path expressions to select nodes in an XML document. The node is selected by following steps. © Sun Technologies Inc. 3 Expression Description nodename Selects all nodes with the name "nodename" / Selects from the root node // Selects nodes in the document from the current node that match the selection no matter where they are . Selects the current node .. Selects the parent of the current node @ Selects attributes
  • 4. Xpath Ways • Xpath can be created in two ways: • Absolute Xpath Absolute Xpath begins with a root path and is prefixed with a “/”. • Relative Xpath Relative Xpath begins from the current location and is prefixed with a “//”. © Sun Technologies Inc. 4
  • 5. XPath Axes An axis defines a node-set relative to the current node. © Sun Technologies Inc. 5 •ancestor •ancestor-or-self •attribute •child •descendant •descendant-or-self •following •following-sibling •namespace •parent •preceding •preceding-sibling •self
  • 6. Selecting Unknown Nodes • XPath wildcards can be used to select unknown XML nodes. © Sun Technologies Inc. 6 Wildcard Description * Matches any element node @* Matches any attribute node node() Matches any node of any kind
  • 7. XPath functions XPath contains a number of functions on node sets, numbers, and strings; here are a few of them: • Contains: contains(arg1, arg2) tests if arg1 contains arg2 Example://img[contains(@src,’Profile’)] • starts-with: starts-with(arg1, arg2) tests if arg1 starts with arg2 Example: //*[starts-with(name(), 'sec'] • ends-with: ends-with(arg1, arg2) tests if arg1 ends with arg2 Example: //*[ends-with(name(), ‘details'] © Sun Technologies Inc. 7