0

This is the code :

enter image description here

And error :

enter image description here

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

Mohsin Awan
  • 1,176
  • 2
  • 12
  • 29

1 Answers1

0

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

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125