
您应该看一下HTMLUnit,它比使用上面的要简单得多。以下页面和代码将指导您:
final WebClient webClient = new WebClient();final HtmlPage page1 = webClient.getPage("http://www.facebook.com");final HtmlForm form = page1.getFormByName("login_form");final HtmlSubmitInput button = form.getInputsByValue("Log in");final HtmlTextInput textField = form.getInputByName("email");textField.setValueAttribute("jon@jon.com");final HtmlTextInput textField = form.getInputByName("pass");textField.setValueAttribute("ahhhh");final HtmlPage page2 = button.click();http://htmlunit.sourceforge.net/gettingStarted.html
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)