Skip to content

Instantly share code, notes, and snippets.

@cpuuntery
Last active April 3, 2022 17:46
Show Gist options
  • Save cpuuntery/17b998704f02dfce2c20cb2ca75a6774 to your computer and use it in GitHub Desktop.
Save cpuuntery/17b998704f02dfce2c20cb2ca75a6774 to your computer and use it in GitHub Desktop.
To get the desired element from XPath you need
1- the element before the desired element
2- the element after the desired element
3- element attributes
## Any attributes will suffice. I mean any attributes, Not only the very popular ones like [id,class,herf]
## For example
## data-tags attribute from safebooru will work
## You don't need to specify the exact value. You just need to specify part of the value, as long full element attribute contain a part of what you did specify
//the_desired_element[preceding::element_before[contains(@attribute,"attributes_Value")]][following::element_after[contains(@attribute,"attributes_Value")]]
for example
//table[preceding::span[contains(@id,"Event_Wishes")]][following::span[contains(@id,"Change_History")]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment