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

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:


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.
  • Your Selenium Client version is 3.4.0 which is almost a year older.

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/caskbrew 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.


Had this same thing happen using Selenium 3.14.0, Chrome 70, Chromedriver 2.43.

The fix for me was the remove the --start-maximized flag from my chromeoptions, and after the browser is open have a call to a method that does:

    driver.manage().window().setPosition(new Point(0, 0));    driver.manage().window().setSize(new Dimension(1920, 1080));

We're also running our remote automation in AWS EC2 containers running CentOS.In Windows and Mac the above flag had no issues when running locally.