I would like to open a link that contains the word google
. It looks like this:
<input class="submit" style="background: #409999; border-radius: 10px;" value="open" onclick="Open('143615', '1', 'https://www.google.de/');" type="submit">
I tried this Greasemonkey code:
var snapResults = document.evaluate("//input[contains(@onclick, 'test')]",document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = snapResults.snapshotLength - 1; i >= 0; i--) {
var elm = snapResults.snapshotItem(i);
// do stuff with elm
if (elm) //open the window, which contains "test"
{
elm.singleNodeValue.click(); //there is no effect ...
alert(i+". element opend");
}
else
{
alert(i+". Not found.");
}
}
It has no effect. I would like to open the window via Greasemonkey (click event ?)
When I use alert(elm.href);
it says it is "undefined". But the XPath works when I try it in FirePath.