admin管理员组

文章数量:1410688

There is a button in the web page as

<input class="button" type="submit" value="new">

I need a greasemonkey script which even before the page pletely loads must automatically click on the button and move to next page.

Thanks.

There is a button in the web page as

<input class="button" type="submit" value="new">

I need a greasemonkey script which even before the page pletely loads must automatically click on the button and move to next page.

Thanks.

Share Improve this question asked Jun 15, 2010 at 17:56 technocrattechnocrat 7355 gold badges13 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

I need a greasemonkey script which even before the page pletely loads must automatically click on the button and move to next page.

With Greasemonkey, you currently can only run a user script on DOM ready which is just before the page load is plete.

With user scripts used on Google Chrome they can run sooner, and eventually you will be able to run userscripts before DOM ready.

As for the code to select and click that button:

document.evaluate("//input[@value='new' and @type='submit' and contains(@class, 'button')]", document, null, 9, null).singleNodeValue.click();

should do the trick

本文标签: javascriptclick a button automatically using greasemonkeyStack Overflow