我有一个要提交的站点表单。问题是该站点的提交按钮没有名称。
表单 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 来说是不可能的吗?如果没有,是否有其他方法可以填写适用于此的表格?
最佳答案
尝试从您最喜欢的浏览器提交表单,看看它如何处理这种情况。不要忘记显示浏览器开发人员工具中的“网络”选项卡。
一旦您知道浏览器如何处理这种情况,请在您的代码中执行相同的操作。
关于java - 如何在没有名称的提交按钮的情况下使用 Jsoup 提交表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30306131/