JavaScript to highlight XPath matches in webpage? -


we need bit of javascript can sent page (by dumping in url bar) highlight matches of given xpath string.

that is, javascript code contain hard-coded xpath string.

i know there developer tools need lightweight api-style solution.

any appreciated. functioning code preferred.

i figured out. (tested in chrome)

paste following in omnibox, delete first 'j' ("javascript:" gets erased w/out double j)

try @ http://www.w3schools.com/jsref/

jjavascript:   var myxpath = "//a[@class='bigbtn']";  var iterator = document.evaluate(myxpath, document, null, xpathresult.unordered_node_iterator_type, null );  try {     var thisnode = iterator.iteratenext();      while (thisnode) {         thisnode.style.outline = "5px dashed red";         thisnode = iterator.iteratenext();     }    } catch (e) {     dump( 'error: document tree modified during iteration ' + e ); } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -