xpath [TAST DokuWiki ]

User Tools

Site Tools


Sidebar

First steps in TAST

What is UML

Computer setup for TAST use

FAQ

Recognized Issues

TAST tool Menu

TAST Adaptors

Adaptors examples

TAST Integrations

Interesting features

Documentation of technical administration

Modeling recommendations

Training in the TAST tool

xpath

This is an old revision of the document!


XPath object identification

In the following lines, the user will find tips for being able to identify the web objects via XPath.

XPath is a way of objects identification based on the path where the element is nested in. As an example, the XPath ”/html/body/div[2]/div/div/footer/section[3]/div/ul/li[3]/a” will search in the html body an element “div[2]”; inside this it will look for a “div”; inside this, another “div”, and then a “footer” and so on and so on…

There are, basically, two different ways to use the XPath, using the complete path, or finding a partial path (for this, instead of opening the sentence with ”/”, they are open with ”/ /”). As always, in testing, it is really important to make sure that the Xpath that we write is unique and represents one element with no possibility of error. As a little reminder, notice that the ID attribute is unique.

Nevertheless, since this way can be too long, there are some ways to shorten it. For this, is necessary to know some syntax related to it:

XPath Expression Description Expression example Example meaning
/Selects from the root node (…)/b/a Element “a” child of “b”, child of ”(…)“
/ /Selects any nodes from the current node that match the selection no matter where they are b / / a(…)All the “a(…)” elements child of “b”.
* Matches any element node (wildcard) b / * / a
. Selects the current node
xpath.1515058136.txt.gz · Last modified: 2018/01/04 09:28 by tast