Skip to content

Instantly share code, notes, and snippets.

@matisnape
Created March 27, 2018 19:16
Show Gist options
  • Save matisnape/48ae886d89c6a50c9753aee7e213b1d4 to your computer and use it in GitHub Desktop.
Save matisnape/48ae886d89c6a50c9753aee7e213b1d4 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment