Sie sind auf Seite 1von 2

Category

  Element  Looked  For   Xpath  (1.0  –  2.0)  


Tag   Element  <E>  by  relative   //E  
reference  
Second  <E>  element  on   (//E)[2]  
the  page  
Element  <E>  with   //E[@A]  
attribute  A  
Element  <E>  with   //E[@A=’t’]  
attribute  A  containing  text  
‘t’  exactly  
Element  <E>  containing   //E[@A  and  not(@B)]  
attribute  A  but  that  does  
not  contain  attribute  B  
Element  <E>  with   //E[contains(@A,  ‘t’)]  
attribute  A  containing  text    
‘t’  
Element  <E>  with   //E[contains(@A,  ‘t’)  and  contains(@B,  
attribute  A  containing   ‘v’)]  
exactly  text  ‘t’  and  
attribute  B  containing  
exactly  text  ‘v’  
Element  <E>  whose   //E[starts=with(@A,  ‘t’)]  
attribute  A  begins  with  ‘t’  
Element  <E>  whose   //E[ends-­‐with(@A,  ‘t’)]  
attribute  A  ends  with  ‘t’  
ID  &  Name   Element  <E>  with  id  ‘I’   //E[@id=’I’]  
All  Elements  with  id  ‘I’   //*[@id=’I’]  
Element  <E>  with  name   //E[@name=’N’]  
‘N’  
All  Elements  with  name   //*[@name=’N’]  
‘N’    
 
All  Elements  with  id  ‘I’  or   //*[@id=’I’  or  @name=’N’]  
name  ‘N’  
Class   Element  <E>  with  a  class  C   //E[@class=’C’]  
Text   All  Elements  with  text  ‘t’   //*[.=’t’]  
exactly  
Element  <E>  containing   //E[contains(text(),  ‘t’)]  
text  ‘t’  
Direct  Child   Element  <F>  which  is  a   //E/F  
direct  child  of  Element  
<E>  
Child  or  subChild   Element  <F>  which  is  a   //E//F  
child  or  a  subchild  of  
Element  <E>  
 

Das könnte Ihnen auch gefallen