eclipse中html设置,无法在eclipse中设置HTMLUNIT

请协助我使用eclipse设置htmlunit。我tryning填写的表格,并通过代码无法在eclipse中设置HTMLUNIT

这里提交这是我的代码

import com.gargoylesoftware.htmlunit.WebClient;

import com.gargoylesoftware.htmlunit.html.HtmlForm;

import com.gargoylesoftware.htmlunit.html.HtmlPage;

import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;

import com.gargoylesoftware.htmlunit.html.HtmlTextInput;

public class Ullas {

public static void main(String[] args) {

WebClient client = new WebClient();

try

{

HtmlPage currentPage = (HtmlPage)client.getPage("http://xx.com");

HtmlForm form = (HtmlForm) CurrentPage.getElementById("login_form");

final HtmlTextInput textField = form.getInputByName("nm");

textField.setValueAttribute("mak");

final HtmlSubmitInput button = form.getInputByName("submitbutton");

//currentPage = form.getAcceptAttribute();

button.click();

}

catch(Exception ex)

{

System.out.println("Some form of error happened !");

}

}

}

我没有包括所有的图书馆,但是当我运行它口口声声说应用的”用户操作等待'建筑工作区'太完整了'

+0

Eclipse可以有有时挂,没有明显的趋势原因(通常是因为记忆力)。尝试重新启动应用程序,如果你已经做到了;问题是否存在? –

+0

问题已解决,但您能解释我上面的代码应该如何工作意味着它应该弹出页面后表单submited或什么,因为当我执行我的代码。它什么都不做 –

+0

上面的代码打开一个网页,输入文本并点击提交按钮。我假设你已经将它指向了正确的域,那么它应该显示结果。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值