无法在 Eclipse 中设置 HTMLUNIT
unable to setup HTMLUNIT in eclipse
请协助我使用 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 !");
}
}
}
我确实包含了所有库,但是当我 运行 应用程序时,它一直在说 "the user operation is waiting for'building workspace' too complete"
Eclipse 有这种奇怪的挂起趋势(通常是由于内存)。大多数时候重启您的实例可以解决问题。或者,运行 eclipse.exe -clean
也应该解决这个问题,因为 eclipse 在启动时会清除所有缓存数据。这个问题已经有好几个用户反馈了,我附上链接供大家参考:
https://www.genuitec.com/forums/topic/myeclipse-hangs-on-building-workspace-0/
User Operation is waiting for "Building Workspace"
请协助我使用 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 !");
}
}
}
我确实包含了所有库,但是当我 运行 应用程序时,它一直在说 "the user operation is waiting for'building workspace' too complete"
Eclipse 有这种奇怪的挂起趋势(通常是由于内存)。大多数时候重启您的实例可以解决问题。或者,运行 eclipse.exe -clean
也应该解决这个问题,因为 eclipse 在启动时会清除所有缓存数据。这个问题已经有好几个用户反馈了,我附上链接供大家参考:
https://www.genuitec.com/forums/topic/myeclipse-hangs-on-building-workspace-0/
User Operation is waiting for "Building Workspace"