Created
December 20, 2019 01:38
-
-
Save airtoxin/82d840862a6870b21a55d74bbb55c1d5 to your computer and use it in GitHub Desktop.
xpath
This file contains 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
javascript:xp=window.prompt("Input XPath");document.getElementsByXPath=function(t,e){for(var n=[],u=document.evaluate(t,e||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=0,l=u.snapshotLength;a<l;a++)n.push(u.snapshotItem(a));return n};alert(document.evaluate(xp, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ).snapshotLength);console.log(xp);console.log(document.getElementsByXPath(xp)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment