无法在eclipse中设置HTMLUNIT

时间:2016-05-15 08:23:18

标签: htmlunit

请帮我用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 !");
            }


        }

}

我确实包含了所有库,但是当我运行应用程序时,它继续说"用户操作正在等待构建工作区'太完整"

1 个答案:

答案 0 :(得分:0)

Eclipse有这种奇怪的倾向(经常是由于内存)。大多数时候重启您的实例可以解决问题。或者,运行eclipse.exe -clean也应解决问题,因为eclipse在启动时清除所有缓存数据。一些用户已经报告了这个问题,我附上链接供您参考:

https://www.genuitec.com/forums/topic/myeclipse-hangs-on-building-workspace-0/

User Operation is waiting for "Building Workspace"

https://www.eclipse.org/forums/index.php/t/512454/

https://bugs.eclipse.org/bugs/show_bug.cgi?id=77946

相关问题