ChromeDriver error “unknown error: cannot get auto

2019-01-19 09:59发布

Since the 7th of February all my tests are failing with the same error; the log entry reads:

RESPONSE MaximizeWindow unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=57.0.2987.21)

I'm not sure if this is caused by a Chrome update or something else - the message is vague enough as it is.

EDIT: I am using C#, and the latest Chromedriver.

14条回答
再贱就再见
2楼-- · 2019-01-19 10:13

I faced the issue, too. I have replaced the existing chrome driver which I had in my C folder with new chrome driver downloaded from https://sites.google.com/a/chromium.org/chromedriver/downloads, which resolved the issue.

查看更多
beautiful°
3楼-- · 2019-01-19 10:14

Thanks for this -- it helped me after so much R&D

cannot-get-automation-extension

ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(o);
查看更多
The star\"
4楼-- · 2019-01-19 10:15

This could probably because the environment where you are running the tests is blocking all the third party extensions in chrome browser. Give it a try with disabling the extensions.

something like below:

ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(o);
查看更多
beautiful°
5楼-- · 2019-01-19 10:15

With the last headless version, you can't resize the window as there isn't any window anymore.

For my own case, I was experiencing this issue with behat, I used to resize the window with previous versions of chrome of firefox, I surround the following line:

$this->getSession()->resizeWindow(1600, 1200, 'current');

with a simple check on the driver:

if (($this->getSession()->getDriver() instanceof Selenium2Driver)) {
    $this->getSession()->resizeWindow(1600, 1200, 'current');
}
查看更多
相关推荐>>
6楼-- · 2019-01-19 10:17

Instead of downloading the chrome driver manually, it's better to update the version of chromedriver in package.json (or similar file) and fire npm install to get the latest version auto downloaded.

查看更多
Juvenile、少年°
7楼-- · 2019-01-19 10:19

As mentioned above, it's related to the chromedriver. In the release notes of version 2.33, it's mentioned that they fixed an issue related to resizing/positioning.

Latest Release: ChromeDriver 2.33

Supports Chrome v60-62

Changes include:

  • Fixes a bug which caused Resizing/Positioning Window commands to fail on Chrome 62+.
查看更多
登录 后发表回答