Whole web page
xpath=/html
css=html
document.documentElement
Whole web
page body
xpath=/html/body
css=body
document.body
All text
nodes of web page
//text()
Element
<E> by absolute reference
xpath=/html/body/.../.../.../E
css=body>…>…>…>E
document.body.childNodes[i]...childNodes[j]
Element
<E> by relative reference
//E
css=E
document.gEBTN('E')[0]
Second
<E> element anywhere on page
xpath=(//E)[2]
document.gEBTN('E')[1]
Image
element
//img
css=img
document.images[0]
Element
<E> with attribute A
//E[@A]
css=E[A]
dom=for each (e
in document.gEBTN('E')) if (e.A) e
Element
<E> with attribute A containing text 't' exactly
//E[@A='t']
css=E[A='t']
Element
<E> with attribute A containing text 't'
//E[contains(@A,'t')]
Element
<E> whose attribute A begins with 't'
//E[starts-with(@A,
't')]
Element
<E> whose attribute A ends with 't'
//E[substring(@A,
string-length(@A) - string-length('t')+1)='t']
Element
<E> with attribute A containing word 'w'
//E[contains(concat('⦿', @A, '⦿'), '⦿w⦿')
Element
<E> with attribute A matching regex ‘r’
Element
<E1> with id I1 or element <E2> with id I2
//E1[@id=I1] |
//E2[@id=I2]
css=E1#I1,E2#I2
Element
<E1> with id I1 or id I2
//E1[@id=I1 or
@id=I2]
css=E1#I1,E1#I2
Attribute A
of element <E>
//E/@A {Se: //E@A }
{Se: css=E@A }
document.gEBTN('E')[0].getAttribute('A')
⌦
{Se:
document.gEBTN('E')[0]@A }
Attribute A
of any element
//*/@A {Se: //*@A }
{Se: css=*@A }
Attribute A1
of element <E> where attribute A2 is 't' exactly
//E[@A2='t']/@A1
⌦ {Se: //E[@A2='t']@A1 }
{Se:
css=E[A2='t']@A1 }
Attribute A
of element <E> where A contains 't'
//E[contains(@A,'t')]/@A
⌦ {Se: //E[contains(@A,'t')]@A }
{Se: @A }
Element
<E> with id I
//E[@id='I']
css=E#I
Element with
id I
//*[@id='I']
css=#I
document.gEBI('I')
id=I