169
edits
No edit summary |
(→PHP) |
||
| Line 16: | Line 16: | ||
//a[text()=’My Text’]: matches a link whose text is “My Text” | //a[text()=’My Text’]: matches a link whose text is “My Text” | ||
** If you want to match more than one string in attribute or text | ** If you want to match more than one string in attribute or text | ||
//a[contains(text(),’Bill’) && contains(text(), ‘Clinton’)]:matches a link | //a[contains(text(),’Bill’) && contains(text(), ‘Clinton’)]:matches a link | ||
whose text contains both Bill and Clinton. You can use any xpath function or | |||
operator to create your expression | |||
** Find the nth element of a type | ** Find the nth element of a type | ||
//div[position()=3]: matches the third div on the page | //div[position()=3]: matches the third div on the page | ||
//div[@id=’abc’]//table[position()=3]: matches the third table inside the div whose id is abc | //div[@id=’abc’]//table[position()=3]: matches the third table inside the div | ||
whose id is abc | |||
edits