简体   繁体   中英

unable to run the HtmlUnit Driver with selenium Webdriver using java

This is the code :

在此处输入图片说明

And error :

在此处输入图片说明

I am trying to run the script in headless browser but it gives the error as mentioned in screenshot.

I will suggest to use phantomjs instead of HTMLUnit driver for headless automation

Now if you want to use headless with phantomjs. download the stable build of phantomjs for your headleass jobs. download it from below link :-

http://phantomjs.org/download.html

Now add System.setPropertybefore driver instance

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);

refer the link below for more info :-

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM