SlideShare une entreprise Scribd logo
1  sur  7
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

Contenu connexe

Tendances

Tendances (20)

jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
jQuery
jQueryjQuery
jQuery
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Xpath.ppt
Xpath.pptXpath.ppt
Xpath.ppt
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
php
phpphp
php
 
Java script
Java scriptJava script
Java script
 
Css
CssCss
Css
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigation
 
Java script
Java scriptJava script
Java script
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Dom
DomDom
Dom
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 

En vedette

Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1Sun Technlogies
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Deutsche Post
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Mobile Application Testing
Mobile Application TestingMobile Application Testing
Mobile Application TestingSun Technlogies
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Seleniumvivek_prahlad
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsSun Technlogies
 
XMPP - Introduction And LAS Implementation (Presentation)
XMPP - Introduction And LAS  Implementation (Presentation)XMPP - Introduction And LAS  Implementation (Presentation)
XMPP - Introduction And LAS Implementation (Presentation)Ralf Klamma
 
Severity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятноеSeverity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятноеDeutsche Post
 

En vedette (20)

Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Jmeter
JmeterJmeter
Jmeter
 
Maven and ANT
Maven and ANTMaven and ANT
Maven and ANT
 
Path Testing
Path TestingPath Testing
Path Testing
 
Selenium
SeleniumSelenium
Selenium
 
Jira
JiraJira
Jira
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Selenium
SeleniumSelenium
Selenium
 
Software testing
Software testingSoftware testing
Software testing
 
Javascript
JavascriptJavascript
Javascript
 
Mobile Application Testing
Mobile Application TestingMobile Application Testing
Mobile Application Testing
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts Basics
 
Introduction
IntroductionIntroduction
Introduction
 
XMPP - Introduction And LAS Implementation (Presentation)
XMPP - Introduction And LAS  Implementation (Presentation)XMPP - Introduction And LAS  Implementation (Presentation)
XMPP - Introduction And LAS Implementation (Presentation)
 
XML
XMLXML
XML
 
Severity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятноеSeverity и Priority для неначинающих: очевидное и невероятное
Severity и Priority для неначинающих: очевидное и невероятное
 

Similaire à XPATH

02_Xpath.pdf
02_Xpath.pdf02_Xpath.pdf
02_Xpath.pdfPrerak10
 
Implementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaImplementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaTristan Penman
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaPrajal Kulkarni
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Dr. Ahmed Al Zaidy
 
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptpptXML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptpptsivani14565220
 
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPathStructured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPathJosh Anderson
 

Similaire à XPATH (20)

X FILES
X FILESX FILES
X FILES
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
Xpath.pdf
Xpath.pdfXpath.pdf
Xpath.pdf
 
Xpath
XpathXpath
Xpath
 
XML Technologies
XML TechnologiesXML Technologies
XML Technologies
 
26xslt
26xslt26xslt
26xslt
 
02_Xpath.pdf
02_Xpath.pdf02_Xpath.pdf
02_Xpath.pdf
 
Session 4
Session 4Session 4
Session 4
 
03 x files
03 x files03 x files
03 x files
 
Implementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaImplementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and Akka
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5
 
XML Pipelines
XML PipelinesXML Pipelines
XML Pipelines
 
X path
X pathX path
X path
 
X path
X pathX path
X path
 
Scrapy.for.dummies
Scrapy.for.dummiesScrapy.for.dummies
Scrapy.for.dummies
 
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptpptXML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
XML(EXtensible Markup Language). XML(EXtensible Markup Language).pptppt
 
Xml
XmlXml
Xml
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPathStructured Strategy: How to Supercharge Your Content Analysis with XML and XPath
Structured Strategy: How to Supercharge Your Content Analysis with XML and XPath
 

Plus de Sun Technlogies

Plus de Sun Technlogies (9)

HyperText Markup Language - HTML
HyperText Markup Language - HTMLHyperText Markup Language - HTML
HyperText Markup Language - HTML
 
Extended Finite State Machine - EFSM
Extended Finite State Machine - EFSMExtended Finite State Machine - EFSM
Extended Finite State Machine - EFSM
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
 
Core java
Core javaCore java
Core java
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
Devops
DevopsDevops
Devops
 
QTest
QTest QTest
QTest
 
Array and functions
Array and functionsArray and functions
Array and functions
 
Sikuli
SikuliSikuli
Sikuli
 

Dernier

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 

Dernier (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 

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