How do I auto-submit a form with Greasemonkey?

不打扰是莪最后的温柔 提交于 2019-12-02 03:34:57

问题


I'm trying to autosubmit a form with greasemonkey however I'm not sure how to do it with this button. The button seems to have the following properties

a class="blue-button" href="javascript:void(0)" onclick="Form.submit(this);"

and the only form I see above is

<form xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://www.blizzard.com/ns/store" action="/account/management/add-game.xml" autocomplete="off" method="post">

The page is here you can use "email9999@trash2009.com" and "a1a1a1a1" as a login.


回答1:


document.getElementsByTagName('form')[0].submit();

Note that this will only work if the first form on the page. You can increase the array index to [1] if you need to, or loop through the array looking for the right form.




回答2:


After you have got the username and password fields filled in, do this:

unsafeWindow.Form.submit(document.getElementsByClassName('submit')[0]);

Check unsafeWindow documentation here.



来源:https://stackoverflow.com/questions/2615186/how-do-i-auto-submit-a-form-with-greasemonkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!