nightmare-xpath
Nightmare plugin to select nodes by xpath expression.
INSTALL
This will install plugin nightmare-xpath
for Nightmare 3.X:
npm install --save-dev nightmare-xpath
Note: If you are looking for plugin for Nightmare 1.X, then use:
npm install nightmare-xpath@1
USAGE
const Nightmare = ;Nightmare; const links = await ; console; // ['https://www.iana.org/domains/example']
API
xpath(selector: string, handler?: (Node: node) => any): Array<any>
selector
Type: string
XPath expression.
handler
Type: function
Optional: Yes
Signature: (Node: node) => any
This function be called on each result of XPathResult
.
We cannot return DOM element to nodejs,
we must return serializable object or primitive.
If function is omitted, node.toString() will be used.