Skip to content

Instantly share code, notes, and snippets.

@daniel12fsp
Created January 5, 2020 15:11
Show Gist options
  • Save daniel12fsp/138931cc265b09c8d6297358dec0a0ce to your computer and use it in GitHub Desktop.
Save daniel12fsp/138931cc265b09c8d6297358dec0a0ce to your computer and use it in GitHub Desktop.
Search node by content(javascript)
const xpath = "//a[contains(text(),'text')]";
const matchingElement = document.evaluate(xpath, 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