Skip to content

crisstanza/xpath-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XPath and CSS Selectors

Common CSS Selectors:

  • #id
  • .class
  • [attribute-name='value']
  • :not([attribute-name=''])
  • [^attribute-name-prefix]
  • [attribute-value-prefix^=value]
  • [attribute-value-suffix$=value]
  • [attribute-value-contais*=value]
  • [attribute-value-prefix~=regular_expression]
  • parent any-child
  • parent > direct-child

Common XPath Selectors:

  • //anywhere
  • /here
  • //anywhere/text()
  • .
  • ..
  • @

Conclusion:

  • Using XPath and CSS selectors in the same project may lead to some name clashes
  • CSS Selector are easier to get a visual representation (in web browser)
  • Only XPath can retrieve comments
  • XPath Axes and Operators: more power to retrieve content or perform math operations

Links:

About

XPath and CSS Selectors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors