I've just upgraded to the latest version of Chrome 87. My Webdriver.io/Selenium tests used to run fine regardless of if the Chrome window was in the foreground or the background. Now, after upgrading, the tests pass if the window is in the foreground, but not if it's in the background.
I'm not minimizing the Chrome window running my tests. I'm just pressing Alt+Tab so that my IDE is in front of Chrome and it's behind.
I know Chrome 87 has a new "feature" where it uses less CPU if it's not in the foreground. Is there a way to turn this off with either Chrome or Chromedriver settings?
It seems that my test is finding the button to click on, but Chrome isn't registering the click.
This is a bug in Chrome 87:
https://bugs.chromium.org/p/chromedriver/issues/detail?id=3641&sort=-id
The workaround is to set the "localState" in Webdriver.io's desiredCapabilities
like the below in Node.JS/Chimpy:
chimpOptions.webdriverio.desiredCapabilities = {
chromeOptions: {
args: ["--no-sandbox", ...],
prefs: {...}
},
localState: {
"browser.enabled_labs_experiments": ["calculate-native-win-occlusion@2"],
},
},
...
};
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> chromeLocalStatePrefs = new HashMap<String, Object>();
List<String> experimentalFlags = new ArrayList<String>();
experimentalFlags.add("calculate-native-win-occlusion@2");
chromeLocalStatePrefs.put("browser.enabled_labs_experiments", experimentalFlags);
options.setExperimentalOption("localState", chromeLocalStatePrefs);
The other workaround is to leave a small lip of the background Chrome window underneath your active browser/IDE/etc.
In the image below, you can see a small amount of the Chrome window running the test.
the latest chrome - chromedriver has resolved this issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With