3
votes

EDITS: New direction for troubleshooting. Original Issue will remain below dashed lines.

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.

I've found a debug log with the following:

[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)

Here is the code from index.js from the reporting tool

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]);
                    });
                });
            });
        });
    };

The issue is coming from the line browserInstance.takeScreenshot()

So the new question is: How do I grant access to Chrome to allow screenshots?

I've tried "--disable-extensions" and "--disable-web-securities" all with no luck.


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.

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.

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?

Protractor Version: 4.0.9
NPM Version: 3.10.9
Node Version: 4.4.3
Chrome Version: 54.0.2840.71
ChromeDriver Version: 2.24
Selenium Standalone: 2.53.1

I'm launching the web server directly as follows:

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 \ 

Bits of my config file:

multiCapabilities: [
  {
   'shardTestFiles': 'true',
   'browserName': 'chrome',
   'ignoreZoomSetting': 'true',
   'platform': "ANY",
   'marionette': 'true',
   'chromeOptions': {
      'args': ['start-maximized']
    },
  },
],

seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect: true,

Error:

[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
1
this most likely is not related to the problem you are facing, but are you aware of a typo in your config file? s/directConnet/directConnectddavison
Nice catch lol. I was not aware, but it didn't seem to make a difference with the issue.d.rodriguez
Any chance the chrome option '--disable-extensions' helps? Try adding it to the args array under capabilities.Gunderson
Still throws the same error on failed spec with the above chrome option :(d.rodriguez
Also, marionette set to true for chrome? Marionette is a firefox option.cnishina

1 Answers

0
votes

When Protractor reads in your configuration, it'll see that you have set directConnect to true. It'll try to launch Chrome with direct connect (see runner.ts). The file that Protractor will assume is the file path that is downloaded by webdriver-manager. So it'll probably be looking for chromedriver_2.24.exe.

I'm confused by your configuration and launch statements. Your launch has a chromedriver.exe. The file name should also have the version number appended to it. So I'm not sure how direct connect is actually working and how you are getting those log statements.

Also, it appears you want to use the selenium standalone feature based on your java launch command. What you'll need to do is remove the directConnect property from your configuration.