I'm working on a Greasemonkey script for weibo.com. I can't pick the elements using XPath on the XHTML page.
This code fails to grab the elements I want:
function resolver(prefix) {
return prefix === 'x' ? 'http://www.w3.org/1999/xhtml' : null;
}
var allLinks, thisLink;
allLinks = document.evaluate(
"//x:a[@href]",
document,
resolver,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);
Only the <a>
elements on the sidebar are picked and the rest are still there. Please refer to this, weibo.com, target page.
Is there anyway to pick all the elements with attribute action-type="login"
?
I used "//x:a[@action-type='login']"
, but It didn't work.