neridaj
neridaj

Reputation: 2183

Angular E2E - Error with Selenium/Protractor Config

I'm trying to use protractor for some e2e testing and have never used it before. The project has been generated using yeoman-gulp-angular and there are some predefined testing tasks/configs. When I try to execute the tasks I see that selenium has started and then the stacktrace outputs a few errors before selenium shuts down. Is there something missing in the configuration?

Protractor config

'use strict';

var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;

// An example configuration file.
exports.config = {
  // The address of a running selenium server.
  //seleniumAddress: 'http://localhost:4444/wd/hub',
  //seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: [paths.e2e + '/**/*.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};

Stacktrace

Starting selenium standalone server...
(node:23800) DeprecationWarning: util.puts is deprecated. Use console.log instead.
Selenium standalone server started at http://[IP]/wd/hub

   Stacktrace:
     UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"23817.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=56.0.2924.87)
  (Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
...
   Stacktrace:
     UnknownError: Error communicating with the remote browser. It may have died.
...
Finished in 4.84 seconds
2 tests, 4 assertions, 4 failures

Shutting down selenium standalone server.

Edit

[launcher] Error: UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
xpi","e":true,"v":"1.7","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0.5","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0","st":1486662567000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0.1","st":1486662567000}}}

Update

I thought thing were fixed but they are not. After running webdriver-manager update and then webdriver-manager status I see chromedriver version available: 2.27 [last]. When I look in node_modules/protractor/selenium I see chromedriver_2.12.zip. Inside node_modules/protractor/config.json I changed the webdriverVersions for chromedriver from 2.12 to 2.27 which is unavailable. Not sure which version I should specify in protractor /config.json.

test-mbp:fota-admin-portal test$ gulp protractor:src
[11:48:17] Starting 'webdriver-update'...
selenium standalone is up to date.
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip...
Error: Got code 404 from https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip
chromedriver_2.27.zip downloaded to /Users/test/project/node_modules/protractor/selenium/chromedriver_2.27.zip

/Users/test/project/node_modules/adm-zip/adm-zip.js:19
           throw Utils.Errors.INVALID_FILENAME;
           ^
Invalid filename

Stacktrace

   Stacktrace:
     UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"26574.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=56.0.2924.87)
  (Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)

Upvotes: 3

Views: 807

Answers (2)

santhosh kumar
santhosh kumar

Reputation: 2019

Execute the below command from command prompt to update the chrome driver from command terminal.

"webdriver-manager udpate"

Once the chrome driver has been update you will be able to run the cases without any issues.

Note - use "webdriver-manager status" to see the version details of the drivers.

Let me know if you have any questions.

Upvotes: 0

AdityaReddy
AdityaReddy

Reputation: 3645

The chromedriver version you have is pretty old and is not compatible with the latest chrome version - 56 you have

Check out the Protractor ChangeLog for details of chromedriver latest versions

Run webdriver-manager update to get the latest drivers and that should fix the issue

You can also check chromium site for chromedriver vs Chrome compatability

Latest Release: ChromeDriver 2.27 Supports Chrome v54-56 This release fixes a bug which caused ChromeDriver to fail on pages with SharedWorkers.

Upvotes: 2

Related Questions