Test API JSON output here
Test API JSON output here
| Selector | Example | Description |
|---|---|---|
| .class | .foo | Elements with class=foo |
| #id | #foo | Element with id=foo |
| element | div | Select all <div> elements |
| parent child | table.books td | Select all <td> inside table having class=books |
| parent > child | tr.book-row td | Select all <td> directly below <tr> having class=book-row |
| element with attribute | dt[data-type='book-title'] | Select all <dt> having data-type='book-title' attribute |
| parent element:nth-child(n) | tr.book-row td:nth-child(3) | Select every 3rd <td> inside <tr> having class=book-row. Ex: ISBN could be the 3rd column in books table |
| parent element:first-child | tr.book-row td:first-child | Select every first <td> inside <tr> having class=book-row. |
| parent element:last-child | tr.book-row td:last-child | Select every last <td> inside <tr> having class=book-row. |
| Selector | Example | Description |
|---|---|---|
| element | div | Select all <div> elements |
| /element | /div | Select all <div> elements starting from the root node |
| //element | //div | Select all <div> elements anywhere in the DOM |
| attributes | //img@alt | Select all alt attributes of <img> |
| element with attribute | //dt[data-type='book-title'] | Select all <dt> having data-type='book-title' attribute |
| //parent/element[n] | //tr[class=book-row]/td[3] | Select every 3rd <td> inside <tr> having class=book-row. Ex: ISBN could be the 3rd column in books table |
| //parent/element[1] | //tr[class=book-row]/td[1] | Select every first <td> inside <tr> having class=book-row. |
| //parent/element[last()] | //tr[class=book-row]/td[last()] | Select every last <td> inside <tr> having class=book-row. |