我尝试用HtmlUnitDriver写一个selenium测试,它是:
HtmlUnitDriver driver = new HtmlUnitDriver();
//driver.setJavascriptEnabled(true);
driver.get(localhostURLAPI);
System.out.println("source of the page now is " + driver.getPageSource());
但是在结果中我将index.html 的HTML用空
欢迎任何帮助
答案 0 :(得分:0)
您需要更改一行:
来自:
HtmlUnitDriver driver = new HtmlUnitDriver();
致:
WebDriver driver = new HtmlUnitDriver();