Update xpath
This commit is contained in:
parent
35667e6a10
commit
1c58b53a45
6
xpath.md
6
xpath.md
|
@ -24,7 +24,7 @@ layout: default
|
||||||
### Attribute selectors
|
### Attribute selectors
|
||||||
|
|
||||||
| CSS | Xpath | ? |
|
| CSS | Xpath | ? |
|
||||||
| --- | --- | |
|
| --- | --- | --: |
|
||||||
| `#id` | `//[@id="id"]` | [?](#predicates) |
|
| `#id` | `//[@id="id"]` | [?](#predicates) |
|
||||||
| `.class` | `//[@class="class"]` *...see below* | |
|
| `.class` | `//[@class="class"]` *...see below* | |
|
||||||
| `input[type="submit"]` | `//input[@type="submit"]` | |
|
| `input[type="submit"]` | `//input[@type="submit"]` | |
|
||||||
|
@ -36,7 +36,7 @@ layout: default
|
||||||
### Order selectors
|
### Order selectors
|
||||||
|
|
||||||
| CSS | Xpath | ? |
|
| CSS | Xpath | ? |
|
||||||
| --- | --- | -- |
|
| --- | --- | --: |
|
||||||
| `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) |
|
| `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) |
|
||||||
| `ul > li:nth-child(2)` | `//ul/li[2]` | |
|
| `ul > li:nth-child(2)` | `//ul/li[2]` | |
|
||||||
| `ul > li:last-child` | `//ul/li[last()]` | |
|
| `ul > li:last-child` | `//ul/li[last()]` | |
|
||||||
|
@ -50,7 +50,7 @@ layout: default
|
||||||
### jQuery
|
### jQuery
|
||||||
|
|
||||||
| jQuery | Xpath | ? |
|
| jQuery | Xpath | ? |
|
||||||
| ------ | --- | -- |
|
| ------ | --- | --: |
|
||||||
| `$('ul > li').parent()` | `//ul/li/..` | [?](#other-axes) |
|
| `$('ul > li').parent()` | `//ul/li/..` | [?](#other-axes) |
|
||||||
| `$('li').closest('section')` | `//li/ancestor-or-self::section` | |
|
| `$('li').closest('section')` | `//li/ancestor-or-self::section` | |
|
||||||
| ---- | ---- | |
|
| ---- | ---- | |
|
||||||
|
|
Loading…
Reference in New Issue