This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// XPath expression to target specific <a> elements | |
const xpath = `/html/body/div[1]/div/div[2]/div/table/tbody/tr/td[3]/a`; | |
// Use document.evaluate to find all nodes matching the XPath expression | |
let links = document.evaluate( | |
xpath, // XPath to locate <a> elements | |
document, // Search within the entire document | |
null, // No namespace resolver needed | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, // Return an ordered snapshot of matching nodes | |
null // No initial result context |