![]() '//E2/following-sibling::*' // element following sibling with one intermediary (css: E2 + * + E1) '//E2/following-sibling::*' // element immediately following sibling (css: E2 + E1) '//E2/following-sibling::E1' // element following some sibling (css: E2 ~ E1) '//E' // every Nth element starting with the (M+1)th (css: E:nth-child(Nn+M)) '//E' // element with no siblings (css: E:only-of-type) '//E' // element that is an only child (css: E:only-child) '//E' // element with no children (E:empty) '//E/.' // parent of element // descendant of element with id I using specific path (css: #I > … > … > … > // descendant of element with id I using unspecified path (css: #I E) '//*' // second-to-last child that is an element (css: E:nth-last-child(2)) '//E' // second-to-last child (css: E:nth-last-of-type(2)) '//*' // second child that is an element (css: E:nth-child(2)) '//E' // last child (css: E:last-of-type) '//E/*' // last child of element E (css: E *:last-child) '//E' // first child (css: E:first-of-type) '//E/*' // first child of element (css: E > *:first-child) '//a' // element containing text 't' (css: // with target link 'url' (css: // link URL labeled with text 't' exactly '//a' // element containing text 't' exactly '//E' // element containing text 't' (css: E:contains('t')) '//*' // element containing text 't' exactly '//E' // element with a class C (css: E.C) Lang & or concat("L", "-"))]' // element is explicitly in language L or subcode (css: E) ID & // element with id I (css: // element with id I (css: // element with name (css: // element with name (css: or // element with id X or, failing that, a name // element with name N & specified 0-based index ‘v’ (css: // element with name N & specified value ‘v’ (css: *) attribute A of element (css: // attribute A of any element (css: * // attribute A1 of element where attribute A2 is 't' exactly (css: // attribute A of element where A contains 't' (css: 4. '//E' // element with attribute A matching regex | // element with id I1 or element with id I2 (css: E1#I1, or // element with id I1 or id I2 (css: E1#I1, E1#I2) '//img' // image element (css: // element with attribute A (css: // element with attribute A containing text 't' exactly (css: // element with attribute A containing text 't' (css: "t")]' // element whose attribute A begins with 't' (css: "t")]' // element whose attribute A ends with 't' (css: E) '(//E)' // second element anywhere on page '//E' // element by relative reference (css: E) '/html/body/./././E' // element by absolute reference (css: body > … > … > … > E) '/html/body' // whole web page body (css: body) '//var|//acronym' // all vars and acronyms '//rdf:Seq/rdf:li/em:id' // using // hrefs of all anchors '/html/body/div/*' // give me whatever after and text()="TRACK"]]' // all td that has font of a "head" class and text "TRACK" './div/b' // a relative and // any anchor in a table without id, contained in a div of "pad" class ![]() ![]() '//div/form/parent::*' // all divs that have form '//table' // all tables with 1 row and 2 cols More: and position()=1]' // every first hr of 'edge' class To test XPath in your Chrome Debugger: $x('/html/body')
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |