Skip to content

Instantly share code, notes, and snippets.

@kmaria
Forked from slotix/css3vsxpath.csv
Created August 10, 2020 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmaria/a8dc426f1fc8e8bf5e030530c7d7b9be to your computer and use it in GitHub Desktop.
Save kmaria/a8dc426f1fc8e8bf5e030530c7d7b9be to your computer and use it in GitHub Desktop.
Goal CSS 3 XPath
All Elements * //*
All P Elements p //p
All Child Elements p>* //p/*
Element By ID #foo //*[@id=’foo’]
Element By Class .foo //*[contains(@class,’foo’)]
Element With Attribute *[title] //*[@title]
First Child of All P p>*:first-child //p/*[0]
All P with an A child Not possible //p[a]
Next Element p + * //p/following-sibling::*[0]
Previous Element Not possible //p/preceding-sibling::*[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment