5

I have an automation framework developed around Selenium-WebDriver which launches Chrome and navigates to specified URL and performs specified automation. When I commissioned the framework to perform a long task and left it overnight to run (Run was not successful). The following day when I tried to re-run a new set of Tests, Selenium was able to fire Chrome but the Browser would not navigate to the specified URL. The following is the detailed stack trace.

Starting ChromeDriver (v2.7.236900) on port 60678
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=41.0.2272.118)
(Driver info: chromedriver=2.7.236900,platform=Windows NT 6.3 x86_64)   (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.12 seconds
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 16:53:24'
System info: os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_25'
Driver info: driver.version: RemoteWebDriver
Session ID: a2fafed66d51994e3ef57bada99fddbf
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:472)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:683)
at com.gravitant.utils.Util.launchBrowser(Util.java:1711)
at com.gravitant.test.RunTests.start(RunTests.java:147)
at com.gravitant.test.RunTests.main(RunTests.java:80)

This is the second time I am facing the same issue. When I tried to google search the error I was able find this particular forum. I tried to re-download Chrome_driver but it did not help. Restarting the system did not help either. I double checked the code and all the set-up but nothing was changed. Curiously I was able to stumble upon a curious solution.

Solution - Re-installing Chrome Browser solved the issue. I was able to run the tests perfectly.

I am curious to understand why this was and what might have caused chrome to behave so oddly.

SohailAQ
  • 1,002
  • 1
  • 13
  • 25
  • It could be chrome version and selenium JAR version mismatch. – Helping Hands Apr 08 '15 at 05:41
  • @Helping Hands I do not think Chrome was updated during that time. Chrome was the same version before uninstalling and re-installing. I do not think that should be the issue. Besides, if that was the issue, the run should have had failed after re-installing as well. What do you think? – SohailAQ Apr 08 '15 at 06:27
  • If chrome version was same then it could be other issue..:) – Helping Hands Apr 08 '15 at 06:35

7 Answers7

6

In my case, the chrome browser version and chromedriver versions were incompatible. Chrome updated automatically from 56 to 57 and my chromedriver version was 2.27. The 2 issues throwing 'org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension' error (when maximizing the browser and when taking screenshots), where fixed after updating to cromdriver version 2.28.

  • hit same issue between v56 and v57 and updating the chrome webdriver fixed the issue. Had to manually bump the version number to get the update to work though, steps described http://stackoverflow.com/a/40315532/276681 – Jerry Mar 24 '17 at 18:08
4

The issue here is, Selenium-WebDriver is unable to launch the installed 3rd Party Extensions in chrome. I encountered the issue today as well, so instead of re-installing google chrome, I deleted all the extensions I had installed on Chrome. I have a couple of "Add Blocker" extensions installed.

SohailAQ
  • 1,002
  • 1
  • 13
  • 25
1

Reason for the exception is chrome failed to load selenium automation extension.

When ever selenium opens chrome browser, selenium loads a chrome extension in chrome browser to work with it from some temp location. If chrome browser failed to load that extension it will throw an exception.

I got the same exception when my organization blocked loading third party extensions in my chrome browser.

Test method 
Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John threw exception: 
System.InvalidOperationException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-  extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=41.0.2272.118)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)

I am using Selenium with C# and Visual Studio.

  • Ok, but how should the OP fix it? – alecxe Apr 08 '15 at 13:04
  • Even I am not sure. We can load external extensions using `ChromeOptions` class but not sure how to load automation extension. I am looking for the solution. – VaraPrasad Pakalapati Apr 08 '15 at 13:22
  • @VaraPrasad What steps did you take to solve the issue? Did you change your code? – SohailAQ Apr 09 '15 at 03:48
  • Can you also elaborate about the extension that is loaded? Does this happen when you are trying to test a chrome extension using selenium or when you are trying to test a website using selenium? – SohailAQ Apr 09 '15 at 04:06
  • @Razvi This issue is not resolved yet. I am looking for solution. You can find brief explanation of this problem at: http://stackoverflow.com/questions/29518159/unable-to-open-chrome-browser-using-selenium-webdriver-loading-unpacked-extensi – VaraPrasad Pakalapati Apr 09 '15 at 07:54
1

I was facing the same issue, In my case the main problem was:

Incompatibility between chrome version and chromedriver version.

Chrome browser is self upgraded, it updates to latest version automatically (In most of case).

So you need to upgrade chromedriver version periodically and there are release notes are also available which describes the compability between chromedriver and chrome version.

Pratik Patel
  • 2,209
  • 3
  • 23
  • 30
1

I had this on my Windows 10 (64 bit) PC after upgrading to Selenium 3.3.1. Downloading Chromedriver 2.29 and overwriting the old version worked. See - https://chromedriver.storage.googleapis.com/index.html?path=2.29/

Chris Liston
  • 155
  • 2
  • 9
0

In case someone is still looking for an answer. Here is the matching response for my situation. https://github.com/SeleniumHQ/selenium/issues/3508 This exactly what is happening in my case where, I'm getting it 60-70% of the time when maximize is called

org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:945)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWindow.maximize(EventFiringWebDriver.java:644)
at org.openqa.selenium.remote.server.handler.MaximizeWindow.call(MaximizeWindow.java:30)
at org.openqa.selenium.remote.server.handler.MaximizeWindow.call(MaximizeWindow.java:1)
0

I found this problem is chromedriver version cause. My case run ok when i update the chromedriver.