1

I have a Geb script visiting http://google.com and printing the title which works perfectly fine with "normal"/headed Google Chrome and its driver (the Windows 32-bit version 2.35). When I set the ChromeOptions.headless field to true, however, the test will kind of freeze. Getting to the page is extremely slow and after the driver is done navigating to the page, the script crashes with the message that the Navigator is empty. So something is obviously going wrong here. I am using Geb 2.1 with the selenium-support-2.52.0-jar.

Do you guys know what is going on?

Best regards

IchBinGrumpig
  • 119
  • 1
  • 1
  • 10
  • 1
    Please add your code. – Pradeep hebbar Feb 20 '18 at 15:17
  • 1
    Did you tried with selenium-support-3.x.x-jar, for chromdriver 2.35, it think selenium 3.x should work better with it. – yong Feb 20 '18 at 15:34
  • Headless mode with chromedriver is NOT supported with selenium 2.52 version. – Fenio Feb 20 '18 at 18:44
  • Thank you for your answers! I upgraded to the selenium-server-standalone-3.9.1 - jar now with the chrome driver version 2.35. I am also using the selenium-chrome-driver-3.9.1 - jar. Unfortunately the crash still happens when chrome starts headlessly. – IchBinGrumpig Feb 22 '18 at 08:54
  • I just changed one of my old Geb projects (Selenium 3.0.1) so as to use Chrome headless (Chromedriver 2.37) instead of PhantomJS, FF or normal Chrome. The tests work flawlessly. So would you mind sharing an [MCVE](http://stackoverflow.com/help/mcve) including Maven build on GitHub and updating this question with a link? I can look into it then. – kriegaex Mar 19 '18 at 03:21

1 Answers1

0

I faced same issue few time back , I was able to create and use headless chrome driver instance using following code:

System.setProperty("webdriver.chrome.driver", webDriverExec)
ChromeOptions chromeOptions = new ChromeOptions()
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("window-size=1200,1100")
driver = new ChromeDriver(chromeOptions)

By using this code and setting the window-size, I was able to solve my problems related to Empty Navigators.

Nikhil
  • 43
  • 7