2017-08-02 71 views

回答

0

我会建议,如果你想使用无头与phantomjs使用phantomjs而不是司机的HtmlUnit无头的自动化现在

。为你的headleass工作下载phantomjs的稳定版本。从下面的链接下载: -

http://phantomjs.org/download.html

现在添加System.setPropertybefore驱动程序实例

DesiredCapabilities caps = new DesiredCapabilities(); 
caps.setJavascriptEnabled(true); // not really needed: JS enabled by default 
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "C:/phantomjs.exe"); 
WebDriver driver = new PhantomJSDriver(caps); 

参考下面的详细信息的链接: -

http://seleniumworks.blogspot.in/2013/03/headless-browser-testing-using.html

相关问题