0% found this document useful (0 votes)
66 views

Xpath Guideline and Practises

The document provides an introduction to XPath, including its syntax, basic operators and functions, and examples. XPath is used to navigate XML documents using path expressions and contains a library of standard functions.

Uploaded by

Lợii
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Xpath Guideline and Practises

The document provides an introduction to XPath, including its syntax, basic operators and functions, and examples. XPath is used to navigate XML documents using path expressions and contains a library of standard functions.

Uploaded by

Lợii
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

XPATH

Quang Le
CONTENT

1. INTRODUCTION
2. SYNTAX
3. BASIC OPERATORS AND
FUNCTIONS
4. EXAMPLES
INTRODUCTION
INTRODUCTION

 XPath is a syntax for defining parts of an XML


document
 XPath uses path expressions to navigate in XML
documents
 XPath contains a library of standard functions

WHAT IS XPATH?
INTRODUCTION

– XML is the most population document for


many purposes
– HTML is also base on tree structure and html
tag like XML
– XHTML is the future of all websites.
SYNTAX
SYNTAX
Basic structure of Xpath is:
– element
– attribute
– attribute value
– text

Ex: <title lang="en">Harry Potter</title>

title = element name


lang = attribute of element
en = value of atribute
Harry Potter = text / content of the element
SYNTAX
<BOOK>
  <TITLE>HARRY POTTER</TITLE>
  <AUTHOR>J K. ROWLING</AUTHOR>
  <YEAR>2005</YEAR>
  <PRICE>29.99</PRICE>
</BOOK>
Relationship of Nodes Examples
Root: The topmost element of the the book element is the root element
tree
Parent the book element is the parent of the title, author, year, and
price
Children the title, author, year, and price elements are all children of the
book element
Siblings the title, author, year, and price elements are all siblings
Ancestors the ancestors of the title element are the book element and the
bookstore element
Descendants descendants of the bookstore element are the book, title,
author, year, and price 
Operators
BASIC OPERATORS
Operator Description Example Return value
| Computes two node-sets //book | //cd Returns a node-set with all
book and cd elements

+ Addition 6+4 10
- Subtraction 6-4 2
* Multiplication 6*4 24
div Division 8 div 4 2
= Equal price=9.80 true if price is 9.80
false if price is 9.90

!= Not equal price!=9.80 true if price is 9.90


false if price is 9.80

< Less than price<9.80 true if price is 9.00


false if price is 9.80

<= Less than or equal to price<=9.80 true if price is 9.00


false if price is 9.90

> Greater than price>9.80 true if price is 9.90


false if price is 9.80

>= Greater than or equal to price>=9.80 true if price is 9.90


false if price is 9.70

or or price=9.80 or price=9.70 true if price is 9.80


false if price is 9.50

and and price>9.00 and price<9.90 true if price is 9.80


false if price is 8.50

mod Modulus (division remainder) 5 mod 2 1


XPATH AXES
AxisName Result
ancestor Selects all ancestors (parent, grandparent, etc.) of the current
node
ancestor-or-self Selects all ancestors (parent, grandparent, etc.) of the current
node and the current node itself
attribute Selects all attributes of the current node

child Selects all children of the current node

descendant Selects all descendants (children, grandchildren, etc.) of the


current node
descendant-or-self Selects all descendants (children, grandchildren, etc.) of the
current node and the current node itself
following Selects everything in the document after the closing tag of the
current node
following-sibling Selects all siblings after the current node

namespace Selects all namespace nodes of the current node

parent Selects the parent of the current node

preceding Selects all nodes that appear before the current node in the
document, except ancestors, attribute nodes and namespace
nodes
preceding-sibling Selects all siblings before the current node

self Selects the current node


Xpath examples
SINGLE SLASH /
Intro It represents an absolute path to the required element
XPath /AAA /AAA/CCC /AAA/DDD/BBB
Target Select the root element Select all elements CCC which Select all elements BBB which
AAA are children of the root are children of DDD which are
element AAA children of the root element
AAA
Results
     <AAA>       <AAA> 
          <BBB/>            <BBB/>       <AAA> 
          <CCC/>            <CCC/>            <BBB/> 
          <BBB/>            <BBB/>            <CCC/> 
          <BBB/>            <BBB/>            <BBB/> 
          <DDD>            <DDD>            <BBB/> 
               <BBB/>                 <BBB/>            <DDD> 
          </DDD>            </DDD>                 <BBB/> 
          <CCC/>            <CCC/>            </DDD> 
     </AAA>      </AAA>           <CCC/> 
     </AAA>
DOUBLE SLASH //
Intro Don’t care where they come from or who are their parents
XPath //BBB //DDD/BBB
Target Select all elements BBB Select all elements BBB which are children of DDD
Results
     <AAA>       <AAA> 
          <BBB/>            <BBB/> 
          <CCC/>            <CCC/> 
          <BBB/>            <BBB/> 
          <DDD>            <DDD> 
               <BBB/>                 <BBB/> 
          </DDD>            </DDD> 
          <CCC>            <CCC> 
               <DDD>                 <DDD> 
                    <BBB/>                      <BBB/> 
                    <BBB/>                      <BBB/> 
               </DDD>                 </DDD> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
THE STAR *
Intro The star * selects all elements located by preceeding path
XPath /AAA/CCC/DDD/* /*/*/*/BBB //*

Target Select all elements enclosed by


elements /AAA/CCC/DDD
Select all elements BBB which have 3
ancestors
Select all elements

Results      <AAA>       <AAA>       <AAA> 


          <XXX>            <XXX>            <XXX> 
               <DDD>                 <DDD>                 <DDD> 
                    <BBB/>                      <BBB/>                      <BBB/> 
                    <BBB/>                      <BBB/>                      <BBB/> 
                    <EEE/>                      <EEE/>                      <EEE/> 
                    <FFF/>                      <FFF/>                      <FFF/> 
               </DDD>                 </DDD>                 </DDD> 
          </XXX>            </XXX>            </XXX> 
          <CCC>            <CCC>            <CCC> 
               <DDD>                 <DDD>                 <DDD> 
                    <BBB/>                      <BBB/>                      <BBB/> 
                    <BBB/>                      <BBB/>                      <BBB/> 
                    <EEE/>                      <EEE/>                      <EEE/> 
                    <FFF/>                      <FFF/>                      <FFF/> 
               </DDD>                 </DDD>                 </DDD> 
          </CCC>            </CCC>            </CCC> 
          <CCC>            <CCC>            <CCC> 
               <BBB>                 <BBB>                 <BBB> 
                    <BBB>                      <BBB>                      <BBB> 
                         <BBB/>                           <BBB/>                           <BBB/> 
                    </BBB>                      </BBB>                      </BBB> 
               </BBB>                 </BBB>                 </BBB> 
          </CCC>            </CCC>            </CCC> 
     </AAA>      </AAA>      </AAA>
BRACKETS []
Intro A number in the brackets [] gives the position of the element in the selected set.
The function last() selects the last element in the selection

XPath /AAA/BBB[1] /AAA/BBB[last()]


Target
Select the first BBB child of element AAA Select the last BBB child of element AAA

Results
     <AAA>       <AAA> 
          <BBB/>            <BBB/> 
          <BBB/>            <BBB/> 
          <BBB/>            <BBB/> 
          <BBB/>            <BBB/> 
     </AAA>      </AAA>
ATTRIBUTE @
Intro Attributes are specified by @ prefix.
XPath //@id //BBB[@id]
Target Select all attributes @id Select BBB elements which have attribute id

Results
     <AAA>       <AAA> 
          <BBB id = "b1"/>            <BBB id = "b1"/> 
          <BBB id = "b2"/>            <BBB id = "b2"/> 
          <BBB name = "bbb"/>            <BBB name = "bbb"/> 
          <BBB/>            <BBB/> 
     </AAA>      </AAA>
ATTRIBUTE @
Intro Attributes are specified by @ prefix.
XPath //BBB[@*] //BBB[not(@*)]
Target Select BBB elements which have any attribute Select BBB elements without an attribute

Results
     <AAA>       <AAA> 
          <BBB id = "b1"/>            <BBB id = "b1"/> 
          <BBB id = "b2"/> 
          <BBB name = "bbb"/>            <BBB id = "b2"/> 
          <BBB/>            <BBB name = "bbb"/> 
     </AAA>           <BBB/> 
     </AAA>
VALUES OF ATTRIBUTES
Intro Values of attributes can be used as selection criteria.
Function normalize-space removes leading and trailing spaces and replaces sequences of
whitespace characters by a single space.
XPath //BBB[@name='bbb'] //BBB[normalize-space(@name)='bbb']
Target Select BBB elements which have attribute Select BBB elements which have attribute name
name with value 'bbb' with value bbb, leading and trailing spaces are
removed before comparison
Results
     <AAA>       <AAA> 
          <BBB id = "b1"/>            <BBB id = "b1"/> 
          <BBB name = " bbb "/>            <BBB name = " bbb "/> 
          <BBB name = "bbb"/>            <BBB name = "bbb"/> 
     </AAA>      </AAA>
COUNT()
Intro Function count() counts the number of selected elements
XPath //*[count(BBB)=2] //*[count(*)=2]

Target Select elements which have two children BBB Select elements which have 2 children

Results
     <AAA>       <AAA> 
          <CCC>            <CCC> 
               <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/> 
          </CCC>            </CCC> 
          <DDD>            <DDD> 
               <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/> 
          </DDD>            </DDD> 
          <EEE>            <EEE> 
               <CCC/>                 <CCC/> 
               <DDD/>                 <DDD/> 
          </EEE>            </EEE> 
     </AAA>      </AAA>
NAME ()
Intro Function name() returns name of the element
XPath //*[name()='BBB'] //*[starts-with(name(),'B')] //*[contains(name(),'C')]
Target Select all elements with
Select all elements name of which Select all elements name of which
name BBB, equivalent starts with letter B contain letter C
with //BBB
Results

     <AAA>       <AAA>       <AAA> 


          <BCC>            <BCC>            <BCC> 
               <BBB/>                 <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/>                 <BBB/> 
          </BCC>            </BCC>            </BCC> 
          <DDB>            <DDB>            <DDB> 
               <BBB/>                 <BBB/>                 <BBB/> 
               <BBB/>                 <BBB/>                 <BBB/> 
          </DDB>            </DDB>            </DDB> 
          <BEC>            <BEC>            <BEC> 
               <CCC/>                 <CCC/>                 <CCC/> 
               <DBD/>                 <DBD/>                 <DBD/> 
          </BEC>            </BEC>            </BEC> 
     </AAA>      </AAA>      </AAA>
STRING-LENGTH ()
Intro The string-length function returns the number of characters in the string
XPath //*[string-length(name()) =
//*[string-length(name()) < 3] //*[string-length(name()) > 3]
3]
Target Select elements with three- Select elements name of which has Select elements with name longer than
letter name one or two characters three characters
Results
     <AAA>       <AAA>       <AAA> 
          <Q/>            <Q/>            <Q/> 
          <SSSS/>            <SSSS/>            <SSSS/> 
          <BB/>            <BB/>            <BB/> 
          <CCC/>            <CCC/>            <CCC/> 
          <DDDDDDD/>            <DDDDDDDD/>            <DDDDDDDD/> 
          <EEEE/>            <EEEE/>            <EEEE/> 
     </AAA>      </AAA>      </AAA>
SEPARATOR |
Intro Several paths can be combined with | separator.
XPath //CCC | //BBB /AAA/EEE | //BBB /AAA/EEE | //DDD/CCC | /AAA | //BBB
Target Select all elements CCC and Select all elements BBB and elements Number of combinations is not
BBB EEE which are children of root restricted
element AAA
Results
     <AAA>       <AAA>       <AAA> 
          <BBB/>            <BBB/>            <BBB/> 
          <CCC/>            <CCC/>            <CCC/> 
          <DDD>            <DDD>            <DDD> 
               <CCC/>                 <CCC/>                 <CCC/> 
          </DDD>            </DDD>            </DDD> 
          <EEE/>            <EEE/>            <EEE/> 
     </AAA>      </AAA>      </AAA>
CHILD
Intro The child axis contains the children of the context node
XPath /child::AAA /child::AAA/child::BBB /child::AAA/BBB
Target Equivalent of /AAA Equivalent of /AAA/BBB Both possibilities can be combined
Results
     <AAA>       <AAA>       <AAA> 
          <BBB/>            <BBB/>            <BBB/> 
          <CCC/>            <CCC/>            <CCC/> 
     </AAA>      </AAA>      </AAA>
PARENT
Intro The parent axis contains the parent of the context node, if there is one.
XPath //DDD/parent::* //DDD/parent::CCC
Target Select all parents of DDD element Select all parents of DDD element
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <DDD>                 <DDD> 
                    <CCC>                      <CCC> 
                         <DDD/>                           <DDD/> 
                         <EEE/>                           <EEE/> 
                    </CCC>                      </CCC> 
               </DDD>                 </DDD> 
          </BBB>            </BBB> 
          <CCC>            <CCC> 
               <DDD>                 <DDD> 
                    <EEE>                      <EEE> 
                         <DDD>                           <DDD> 
                              <F/>                                <F/> 
                         </DDD>                           </DDD> 
                    </EEE>                      </EEE> 
               </DDD>                 </DDD> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
DESCENDANT 
Intro The descendant axis contains the descendants of the context node
A descendant is a child or a child of a child and so on
Thus the descendant axis never contains attribute or namespace nodes
XPath /AAA/BBB/descendant::* //CCC/descendant::* //CCC/descendant::DDD
Target Select all descendants of /AAA/BBB Select all elements which have CCC among Select elements DDD which have CCC among
its ancestors its ancestors
Results
     <AAA>       <AAA>       <AAA> 
          <BBB>            <BBB>            <BBB> 
               <DDD>                 <DDD>                 <DDD> 
                    <CCC>                      <CCC>                      <CCC> 
                         <DDD/>                           <DDD/>                           <DDD/> 
                         <EEE/>                           <EEE/>                           <EEE/> 
                    </CCC>                      </CCC>                      </CCC> 
               </DDD>                 </DDD>                 </DDD> 
          </BBB>            </BBB>            </BBB> 
          <CCC>            <CCC>            <CCC> 
               <DDD>                 <DDD>                 <DDD> 
                    <EEE>                      <EEE>                      <EEE> 
                         <DDD>                           <DDD>                           <DDD> 
                                                             <FFF/>                                <FFF/> 
                         </DDD>                           </DDD>                           </DDD> 
                    </EEE>                      </EEE>                      </EEE> 
               </DDD>                 </DDD>                 </DDD> 
          </CCC>            </CCC>            </CCC> 
     </AAA>      </AAA>      </AAA>
DESCENDANT-OR-SELF 
Intro The descendant-or-self axis contains the context node and the descendants of the context
node
XPath /AAA/XXX/descendant-or-self::* //CCC/descendant-or-self::*
Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <ZZZ>                 <ZZZ> 
                    <DDD/>                      <DDD/> 
               </ZZZ>                 </ZZZ> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
ANCESTOR  
Intro The ancestor axis contains the ancestors of the context node
The ancestors of the context node consist of the parent of context node and the parent's parent and so
on
Thus, the ancestor axis will always include the root node, unless the context node is the root node.

XPath /AAA/BBB/DDD/CCC/EEE/ancestor::* //FFF/ancestor::*

Target Select all elements given in this absolute path Select ancestors of FFF element

Results
     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <DDD>                 <DDD> 
                    <CCC>                      <CCC> 
                         <DDD/>                           <DDD/> 
                         <EEE/>                           <EEE/> 
                    </CCC>                      </CCC> 
               </DDD>                 </DDD> 
          </BBB>            </BBB> 
          <CCC>            <CCC> 
               <DDD>                 <DDD> 
                    <EEE>                      <EEE> 
                         <DDD>                           <DDD> 
                              <FFF/>                                <FFF/> 
                         </DDD>                           </DDD> 
                    </EEE>                      </EEE> 
               </DDD>                 </DDD> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
ANCESTOR-OR-SELF 
Intro The ancestor-or-self axis contains the context node and the ancestors of the context node
The ancestor-or-self axis will always include the root node

XPath /AAA/XXX/DDD/EEE/ancestor-or-self::* //GGG/ancestor-or-self::*


Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <ZZZ>                 <ZZZ> 
                    <DDD/>                      <DDD/> 
               </ZZZ>                 </ZZZ> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
FOLLOWING  
Intro The following axis contains all nodes in the same document as the context node that are after the
context node in document order
XPath /AAA/XXX/following::* //ZZZ/following::*
Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <ZZZ>                 <ZZZ> 
                    <DDD/>                      <DDD/> 
                    <DDD>                      <DDD> 
                         <EEE/>                           <EEE/> 
                    </DDD>                      </DDD> 
               </ZZZ>                 </ZZZ> 
               <FFF>                 <FFF> 
                    <GGG/>                      <GGG/> 
               </FFF>                 </FFF> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
FOLLOWING-SIBLING  
Intro The following-sibling axis contains all the following siblings of the context node. (the same
level)
XPath /AAA/BBB/following-sibling::* //CCC/following-sibling::*
Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <DDD/>                 <DDD/> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
PRECEDING  
Intro The preceding axis contains all nodes in the same document as the context node that are before the
context node in document order
XPath /AAA/XXX/preceding::* //GGG/preceding::*
Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <ZZZ>                 <ZZZ> 
                    <DDD/>                      <DDD/> 
               </ZZZ>                 </ZZZ> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
PRECEDING-SIBLING  
Intro The preceding-sibling axis contains all the preceding siblings of the context node(the same and smaller
level)
XPath /AAA/XXX/preceding-sibling::* //CCC/preceding-sibling::*
Target
Results

     <AAA>       <AAA> 
          <BBB>            <BBB> 
               <CCC/>                 <CCC/> 
               <DDD/>                 <DDD/> 
          </BBB>            </BBB> 
          <XXX>            <XXX> 
               <DDD>                 <DDD> 
                    <EEE/>                      <EEE/> 
                    <DDD/>                      <DDD/> 
                    <CCC/>                      <CCC/> 
                    <FFF/>                      <FFF/> 
                    <FFF>                      <FFF> 
                         <GGG/>                           <GGG/> 
                    </FFF>                      </FFF> 
               </DDD>                 </DDD> 
          </XXX>            </XXX> 
          <CCC>            <CCC> 
               <DDD/>                 <DDD/> 
          </CCC>            </CCC> 
     </AAA>      </AAA>
OTHERS 
Intro The div operator performs floating-point division
The mod operator returns the remainder from a truncating division.
The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an
integer.
The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an
integer.
XPath //BBB[position() mod 2 =0]
//BBB[ position() = floor(last() div 2 + 0.5) //CCC[ position() = floor(last() div 2 + 0.5) or
or position() = ceiling(last() div 2 + 0.5) ] position() = ceiling(last() div 2 + 0.5) ]
Target Select even BBB elements Select middle BBB element(s) Select middle CCC element(s)
Results
     <AAA>       <AAA>       <AAA> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <BBB/>            <BBB/>            <BBB/> 
          <CCC/>            <CCC/>            <CCC/> 
          <CCC/>            <CCC/>            <CCC/> 
          <CCC/>            <CCC/>            <CCC/> 
     </AAA>      </AAA>      </AAA>
• What is XPath?
• What is generic syntax of XPath
selector?
• How many XPath locators are
there? What are they?
Practice 1 • How many types of XPath? What
Now please answer questions to are they?
summarize things about XPath selector
you have just learned • What is XPath axis? List out at least
5 axes in XPath.
• How to mention an attribute in
XPath selector?
• List out 5 XPath functions you have
learned?
• TC: Verify that user is able to
create new tours in PHP travel
admin
1. Login to Admin site
2. Click on Account tab and verify
Practice 2 login correct or not
3. Back to dashboard page
So that we need to define all elements xpath
locators that we will execute actions on them 4. Click on tours menu
to go through the flow.
5. Click on tours sub menu
User: https://www.phptravels.net/
Email [email protected] 6. Click add button
Password demouser
Admin: https://www.phptravels.net/admin
7. Fill required information
Email [email protected]
Password demoadmin
8. Click submit
Expected result: The new tour
should be created
• Go through user site and create
any e2e test case for any
function
• Then catch the elements for
your test cases.
Practice 3
So that we need to define all elements xpath
locators that we will execute actions on them
to go through the flow.

User: https://www.phptravels.net/
Email [email protected]
Password demouserAdmin:

Admin: https://www.phptravels.net/admin
Email [email protected]
Password demoadmin

You might also like