title: Chrome Automation Extension Error using Selenium with Protractor/Jasmine
body: <p>EDITS:  New direction for troubleshooting.  Original Issue will remain below dashed lines.</p>
  
  <p>After further investigation I realized it was my screenshot reported causing the crash.  I'm using protractor-jasmine2-screenshot-reporter to generate reports and screenshots on failing test cases.  Thus, when a spec would fail, it would take a screenshot, and crash using Chrome.</p>
  
  <p>I've found a debug log with the following:</p>
  
  <pre><code>[1026/090128:ERROR:process_reader_win.cc(114)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights.  (0xc0000022)
  [1026/090128:ERROR:exception_snapshot_win.cc(87)] thread ID 46316 not found in process
  [1026/090128:WARNING:crash_report_exception_handler.cc(56)] ProcessSnapshotWin::Initialize failed
  [1026/093428:ERROR:process_reader_win.cc(114)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights.  (0xc0000022)
  </code></pre>
  
  <p>Here is the code from index.js from the reporting tool</p>
  
  <pre><code>this.specDone = function (spec) {
          spec.filename = {};
          spec = getSpecClone(spec);
          spec._finished = Date.now();
  
          if (!isSpecValid(spec)) {
              spec.skipPrinting = true;
              return;
          }
  
          _.each(browser.forkedInstances, function (browserInstance, key) {
              if (!browserInstance) return;
              browserInstance.takeScreenshot().then(function (png) {
                  browserInstance.getCapabilities().then(function (capabilities) {
                      var screenshotPath,
                          metadataPath,
                          metadata;
  
                      var file = opts.pathBuilder(spec, suites, capabilities);
                      spec.filename[key] = file + '.png';
  
                      screenshotPath = path.join(opts.dest, spec.filename[key]);
                      metadata = opts.metadataBuilder(spec, suites, capabilities);
  
                      if (metadata) {
                          metadataPath = path.join(opts.dest, file + '.json');
                          mkdirp(path.dirname(metadataPath), function (err) {
                              if (err) {
                                  throw new Error('Could not create directory for ' + metadataPath);
                              }
                              writeMetadata(metadata, metadataPath);
                          });
                      }
  
                      mkdirp(path.dirname(screenshotPath), function (err) {
                          if (err) {
                              throw new Error('Could not create directory for ' + screenshotPath);
                          }
                          writeScreenshot(png, spec.filename[key]);
                      });
                  });
              });
          });
      };
  </code></pre>
  
  <p>The issue is coming from the line <b> browserInstance.takeScreenshot() </b></p>
  
  <p>So the new question is: How do I grant access to Chrome to allow screenshots?</p>
  
  <p>I've tried "--disable-extensions" and "--disable-web-securities" all with no luck.</p>
  
  <hr>
  
  <p>ORIGINAL:
  For some time now I haven't been able to run my E2E Protractor/Jasmine tests in Chrome due to a "WebDriverError: unknown error: cannot get automation extension" issue.  </p>
  
  <p>Previously, when running a test in Chrome, it would attempt to load the page and then just crash with the above error.  As of recently, I've done some updating to my tools and can at least get my tests running in Chrome again. However, this time I get the same automation extension error whenever a spec fails and it does not log or report the spec, nor does it continue to the remaining specs in the file.</p>
  
  <p>Tests that pass successfully work fine.  Tests that have failures within them time out and do not log.  Anyone have any insight on if this is still a browser thing or if I'm doing some wrong?</p>
  
  <p>Protractor Version: <b>4.0.9</b><br>
  NPM Version: <b>3.10.9</b><br>
  Node Version: <b>4.4.3</b><br>
  Chrome Version: <b>54.0.2840.71</b><br>
  ChromeDriver Version: <b>2.24</b><br>
  Selenium Standalone: <b>2.53.1</b><br></p>
  
  <p>I'm launching the web server directly as follows:</p>
  
  <pre><code>java -jar C:/.../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar \ 
  -Dwebdriver.chrome.driver=C:/.../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver.exe \ 
  </code></pre>
  
  <p>Bits of my config file:</p>
  
  <pre><code>multiCapabilities: [
    {
     'shardTestFiles': 'true',
     'browserName': 'chrome',
     'ignoreZoomSetting': 'true',
     'platform': "ANY",
     'marionette': 'true',
     'chromeOptions': {
        'args': ['start-maximized']
      },
    },
  ],
  
  seleniumAddress: 'http://localhost:4444/wd/hub',
  directConnect: true,
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>[74.302][SEVERE]: Timed out receiving message from renderer: -11.004
  13:48:15.377 WARN - Exception thrown
  org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
  from timeout: cannot determine loading status
  from timeout: Timed out receiving message from renderer: -11.004
    (Session info: chrome=54.0.2840.71)
    (Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 21.02 seconds
  Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
  System info: host: 'SIWKSTN18', ip: '10.0.0.165', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_67'
  Session ID: a4a6e50c6de395381639c6fa4885a9ab
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities [{platform=WIN8_1, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\DRODRI~1\AppData\Local\Temp\scoped_dir200_9106, chromedriverVersion=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf)}, networkConnectionEnabled=false, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=54.0.2840.71, pageLoadStrategy=normal, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
          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:206)
          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
          at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:335)
          at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:36)
          at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:1)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  13:48:15.378 WARN - Exception: unknown error: cannot get automation extension
  from timeout: cannot determine loading status
  from timeout: Timed out receiving message from renderer: -11.004
  </code></pre>