Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save diogorb/0fec0c63158f29daf38e4822499da868 to your computer and use it in GitHub Desktop.

Select an option

Save diogorb/0fec0c63158f29daf38e4822499da868 to your computer and use it in GitHub Desktop.
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
@diogorb
Copy link
Author

diogorb commented Oct 2, 2020

document.evaluate('/html/body/div[4]/div[2]/div/div/div/div[3]/div/span[2]/span', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerHTML;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment