I have installed greasemonkey plug-in for Firefox (my FF version is 21.0). I wrote a userscript named mahesh.user.js
var links = document.evaluate("//span", document.body, null, 6, null);
Now when I print the following
console.log(links);
The Firebug debugger writes out the XPathResult object. But I am unable to use any of the XPathResult properties such as snapshotLength or methods such as iterateNext() or snapshotItem(). Nothing gets printed on the console if I do this.
i.e.
var thisLink = links.iterateNext();
console.log("I am here -- 111: " + thisLink);
i = 0;
while(thisLink) {
console.log("thisLink #" + (++i));
}
Nothing gets printed on the console except for the first "I am here".
Need help please. Kindly advice.
Regards Mahesh.