WebDriverException: unknown error: failed to change window state to maximized, current state is normal with Chrome 70 & Chromedriver 2.43 on MAC OS X

This error message...

org.openqa.selenium.WebDriverException: unknown error: failed to change window state to maximized, current state is normal

...implies that the ChromeDriver was unable to maximize the window state of Chrome Browser client.


Buggy Mac OSX ChromeDriver Replaced

After Chrome version 70 was released, some of you have reported that using ChromeDriver to maximize browser window on Mac no longer works. ChromeDriver Team have investigated this issue, and created a fix for it. ChromeDriver builds with the fix are now available at the following locations:

  • If you are using Chrome version 70 (the current stable release), please download ChromeDriver version 70.0.3538.97 from https://chromedriver.storage.googleapis.com/index.html?path=70.0.3538.97/
  • If you are using Chrome version 71 (the current beta release), please download ChromeDriver version 71.0.3578.33 from https://chromedriver.storage.googleapis.com/index.html?path=71.0.3578.33/

Snapshot of ChromeDriver Release Email

ChromeDriver_new


However, your main issue is the incompatibility between the version of the binaries you are using as follows:

  • Your JDK version is 1.8.0_131 which is pretty ancient.
    • Upgrade JDK to recent levels JDK 8u181.
  • Your Selenium Client version is 3.4.0 which is almost a year older.
    • Upgrade Selenium to current levels Version 3.14.0.

From another perspective, this issue looks like a regression issue from Feature request : ChromeDriver to support window resizing over a remote connection.

ChromeDriver v2.43 in the Release Notes have explicitly mentioned:

ChromeDriver to support window resizing over a remote connection

However, as per best practices to maximize the Chrome Browser client it is suggested to use ChromeOptions class as follows:

System.setProperty("webdriver.chrome.driver", "C:\\your_directory\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.addArguments("disable-infobars");
opt.addArguments("--start-maximized");
opt.addArguments("--disable-extensions");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://google.com");

Reference

You can find a detailed discussion in driver.manage().window().maximize() issue with ChromeDriver 2.33


Update(Nov 20, 2018)

  • ChromeDriver 2.44 has been released.
  • ChromeDriver 2.44 supports Chrome versions 69 to 71
  • This release is similar to ChromeDriver 2.43, but with additional bug fixes.
  • A ChromeDriver that supports chrome 72.x is expected to be released in the early December.

Updating chromedriver to version 2.44 solved the problem for me (sort of). Don't get the error anymore, but window is maximized horizontally beyond the screen. However, the tests work.

Option 1. Install via homebrew

If you have previously installed it via homebrew, it has been moved to cask. So uninstall the old version:

brew uninstall chromedriver

Then install the new version from cask:

brew tap homebrew/cask
brew cask install chromedriver

Now you should have the new version in your path and the error is gone.

Option 2. Download the driver

Download the driver from

https://chromedriver.storage.googleapis.com/index.html?path=2.44/

And place it to your path.