在Greasemonkey中使用document.evaluate

时间:2015-10-18 00:00:48

标签: javascript greasemonkey

使用Greasemonkey,我想自动点击这个元素:

<input class="autostar {split:2}" type="radio" value="5.0" name="rating-1" style="display:none" f="5">

我写过这个,但它不起作用:

var result = document.evaluate("//input[@type='radio' and @name='rating-1 and @value='5.0']",
document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

window.onload = function () {
    result.click();
}

0 个答案:

没有答案