From 921d193026e3cfd7e3383f077c44c3293cbf4c5a Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Fri, 17 Apr 2015 15:48:45 +0800 Subject: [PATCH] Update xpath --- xpath.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/xpath.md b/xpath.md index 1fcf5ff4c..c10b03113 100644 --- a/xpath.md +++ b/xpath.md @@ -28,6 +28,7 @@ layout: default | `#id` | `//[@id="id"]` | [?](#predicates) | | `.class` | `//[@class="class"]` *...see below* | | | `input[type="submit"]` | `//input[@type="submit"]` | | +| `a#abc[for="xyz"]` | `//a[@id="abc"][@for="xyz"]` | [?](#chaining-order) | | --- | --- | | | `a[href^='/']` | `//a[starts-with(@href, '/')]` | [?](#string-functions) | | `a[href$='pdf']` | `//a[ends-with(@href, '.pdf')]` | | @@ -35,16 +36,16 @@ layout: default ### Order selectors -| CSS | Xpath | ? | -| --- | --- | --: | -| `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) | -| `ul > li:nth-child(2)` | `//ul/li[2]` | | -| `ul > li:last-child` | `//ul/li[last()]` | | -| --- | --- | | -| `li#id:first-child` | `//li[@id="id"][1]` | [?](#chaining-order) | -| --- | --- | | -| `a:first-child` | `//a[1]` | | -| `a:last-child` | `//a[last()]` | | +| CSS | Xpath | ? | +| --- | --- | --: | +| `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) | +| `ul > li:nth-child(2)` | `//ul/li[2]` | | +| `ul > li:last-child` | `//ul/li[last()]` | | +| --- | --- | | +| `li#id:first-child` | `//li[@id="id"][1]` | | +| --- | --- | | +| `a:first-child` | `//a[1]` | | +| `a:last-child` | `//a[last()]` | | {:.greycode.no-head} ### jQuery