1
我有一个我想提交的网站表单。问题是本网站的提交按钮没有名称。如何在没有提交按钮的情况下使用Jsoup提交表单?
HTML表单:
<form class="login" action="oauth" method="post" name="login">
<input name="username" value="" id="username"/>
<input name="password" type="password" id="password"/>
<input class="button" type="submit" value="Login"/>
</form>
我当前的Java代码
Document response = Jsoup.connect(url)
.data("username", "username")
.data("password", "reallygoodpassword")
.data("", "Login") //But how to tag the button here?
.post();
或者,这是不可能的Jsoup?如果没有,是否有其他填写表格的方法可以解决这个问题?
您是否真的必须为该按钮发布一个值?你没有尝试过吗? – greenapps
如果我只是填写“”或为空,它会给出一个不能为空的错误 –
该按钮不是数据表单的一部分。在html中,按钮“value”属性仅代表按钮标签。你应该从你的post命令中删除它。 –