Selenium HtmlUnitDriver Angular2

时间:2017-11-08 13:03:50

标签: java angular selenium

我尝试用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用空

欢迎任何帮助

1 个答案:

答案 0 :(得分:0)

您需要更改一行:

来自:

HtmlUnitDriver driver = new HtmlUnitDriver();   

致:

WebDriver driver = new HtmlUnitDriver();