User Tools

Site Tools


xpath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

xpath [2018/01/08 12:37]
tast
xpath [2020/10/21 14:37] (current)
montse
Line 1: Line 1:
-===== XPath object identification =====+====== XPath object identification ​======
  
-{{:​TAST-icon.png?​nolink&​70|}} ​In the following lines, the user will find tips for being able to identify the web objects via XPath.+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... 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...
Line 34: Line 34:
 |text() |Selects the elements with a specific text within |de[text()="​mg"​] |"//​de//"​ elements with the string "//​mg//"​ in the text field| |text() |Selects the elements with a specific text within |de[text()="​mg"​] |"//​de//"​ elements with the string "//​mg//"​ in the text field|
 |[ / @ ] |Selects the elements that have specific children| / / de[mg/​@attr1='​nrw'​]|"//​de//"​ elements which have a "//​mg//"​ child with an attribute "//​attr1//"​ equal to "//​nrw//"​| |[ / @ ] |Selects the elements that have specific children| / / de[mg/​@attr1='​nrw'​]|"//​de//"​ elements which have a "//​mg//"​ child with an attribute "//​attr1//"​ equal to "//​nrw//"​|
 +
 +\\  ​
 +
 +
 +
 +
 +
 +===== How to Obtain Xpath in a XML document =====
 +
 +How to obtain the Xpath of the XML node with Notepad ++:\\ \\   
 +    1. Inside Notepad++ go to Plugins then go to Plugin Manager and click in Show Plugin Manager.\\ 2. Install XML Tools.\\ 3. Restart Notepad++.\\ 4. Load your XML document.\\ 5. Place your cursor on to the node you are looking to generate the Xpath.\\ 6. Go to plugins then XML Tools and select Current XML Plath (Default Hotkey: Ctrl + Alt + Shift + P).\\ \\      ​
 +Then you have a copy of the Xpath in the clipboard.
 + 
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
xpath.1515415024.txt.gz ยท Last modified: 2018/01/08 12:37 by tast