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 completely loads must automatically click 开发者_运维技巧on the button and move to next page.
Thanks.
I need a greasemonkey script which even before the page completely 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 complete.
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
精彩评论