Xpath1 Bookmarklet

....!

Source (www.testingdiaries.com)


Download Bookmarklet:


View Bookmarklet Code:

Bookmarklet Source Code:

javascript%3Afunction%20getNode%28node%29%20%7B%20var%20nodeExpr%3Dnode.tagName%3B%20if%28%21nodeExpr%29return%20null%3B%20if%28node.id%21%3D%27%27%29%20%7B%20nodeExpr+%3D%22%[email protected]%3D%27%22+node.id+%22%27%5D%22%3B%20return%20%22/%22+nodeExpr%3B%20%7D%20var%20rank%3D1%3B%20var%20ps%3Dnode.previousSibling%3B%20while%28ps%29%20%7B%20if%28ps.tagName%3D%3Dnode.tagName%29%20%7B%20rank++%3B%20%7D%20ps%3Dps.previousSibling%3B%20%7D%20if%28rank%3E1%29%20%7B%20nodeExpr+%3D%27%5B%27+rank+%27%5D%27%3B%20%7D%20else%20%7B%20var%20ns%3Dnode.nextSibling%3B%20while%28ns%29%20%7B%20if%28ns.tagName%3D%3Dnode.tagName%29%20%7B%20nodeExpr+%3D%27%5B1%5D%27%3B%20break%3B%20%7D%20ns%3Dns.nextSibling%3B%20%7D%20%7D%20return%20nodeExpr%3B%20%7D


Rate it:


Tags:

Comments

Comments so far. Add yours.