Not able to run Protractor / Jasmine tests with Microsoft Edge

1.6k views Asked by At

I'm working on a project to begin testing Node/Angular applications using Protractor and Jasmine. I have a POC working in most browsers but having a lot of trouble with MS Edge. Here's my environment:

OS: Windows 10 Pro (Version 1709, OS Build 16299.98)
Edge: 41.16299.15.0
EdgeHTML: 16.16299
MS Web Driver: 10.0.16299.15
Node: 6.12.0
Protractor: 5.2.1
Jasmine: 2.8.0
Selenium: 3.8.1

When I run the tests in Chrome, Firefox, and IE (11) the behavior is fine (tests run with expected results). However, with MS Edge the process fails before the test spec can even run.

Example code/output use the Protractor tutorial but I have the same issue when working with our application.

Working conf.js (for Chrome and Firefox)

exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['./spec/spec.js'],

  multiCapabilities: [
    { 'browserName': 'chrome' },
    { 'browserName': 'firefox', 'marionette': true, 'firefox_binary': "C:\\Program Files\\Mozilla Firefox\\firefox.exe" }//,
]  
}

Failing conf.js (for MS Edge)

exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:17556',
  specs: ['./spec/spec.js'],

  capabilites: { browserName: 'MicrosoftEdge' }
}

spec.js

// spec.js
describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');

    expect(browser.getTitle()).toEqual('Super Calculator');
  });
});

When I run the test for MS Edge after starting the Microsoft Web Driver the following occurs:

$ protractor conf.js
[14:14:18] I/launcher - Running 1 instances of WebDriver
[14:14:18] I/hosted - Using the selenium server at http://localhost:17556
[14:14:20] E/launcher - Error code: 135
[14:14:20] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:17556
[14:14:20] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:17556
    at ClientRequest.<anonymous> (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:238:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1281:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:761:15)
    at createDriver (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:626:16)
    at Hosted.getNewDriver (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
    at Runner.createBrowser (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
[14:14:20] E/launcher - Process exited with error code 135

The problem seems to be somewhere around that it says it is using the server on 'localhost' but then makes requests on '127.0.0.1' instead. In theory, they are the same. But in operation, only 'localhost' is responsive. If I try to access 127.0.0.1:17556 it doesn't respond.

This website could not be found
Error Code: INET_E_RESOURCE_NOT_FOUND

I've been looking around a long time (here, SQA, and, the Protactor discussions on GitHub) for info on this but have not found a resolution. Some discussion on GitHub indicates MS Edge testing with Protractor was working at one point. Has anyone been able to successfully run Protractor tests with this version of MS Edge and MS Webdriver?

One final bit of info: I have access to another Windows 10 machine that has an older version of Edge (10240). On that machine I don't have this problem (localhost vs 127.0.0.1), but, it is old enough to still have issues with async and I'm not able to use it for testing with Protractor.

Thanks!

UPDATE

The spec file has not changed but I have updated the config file (conf.js):

// conf.js
exports.config = {
    directConnect: false,
    framework: 'jasmine',
    specs: ['./spec/spec.js'],
    seleniumAddress: 'http://localhost:4444/wd/hub',

    multiCapabilities: [
        //{ 'browserName': 'chrome' },
        //{ 'browserName': 'firefox', 'marionette': true, 'firefox_binary': "C:\\Program Files\\Mozilla Firefox\\firefox.exe" },
        { 'browserName': 'MicrosoftEdge' }
    ]
};

When enabled Chrome and Firefox are able to run the test.

Edge fails with the following (timeout waiting for driver server to start):

$ protractor conf.js
[13:13:53] I/launcher - Running 1 instances of WebDriver
[13:13:53] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[13:14:13] E/launcher - Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'QA-01', ip: '10.1.1.80', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.1'
Driver info: driver.version: unknown
[13:14:13] E/launcher - WebDriverError: Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'QA-01', ip: '10.1.1.80', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.1'
Driver info: driver.version: unknown
    at WebDriverError (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:27:5)
    at Object.checkLegacyResponse (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at createDriver (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:635:14)
    at Hosted.getNewDriver (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
    at Runner.createBrowser (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\runner.js:195:43)
    at q.then.then (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\built\runner.js:339:29)
    at _fulfilled (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
    at C:\Users\USER.NAME\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
[13:14:13] E/launcher - Process exited with error code 199

As before - the same setup on an older version of Windows 10, Edge (10240), and, the Edge Driver do try to run the tests (albeit with the async execution issue).

This setup is probably better than what I used before but the overall outcome is the same. Protractor tests (on this machine) aren't running in MS Edge (16299).

Any insight or advice is much appreciated.

Thanks!

2

There are 2 answers

1
tehbeardedone On

From what I can gather you need to tell protractor where to find the Edge driver. I found a few blog posts that mention adding seleniumArgs to the config.

seleniumArgs: ['-Dwebdriver.edge.driver=your/path/to/MicrosoftWebDriver.exe']
0
kharkins224 On

After additional time and working with yet another Windows 10 machine I have successfully gotten this simple test to run.

I can only conclude that there was something on that particular machine preventing proper execution of the test. I wasn't able to figure out what that was, but, the "does it work?" question is answered. It does (which is what one would expect).

conf.js:

// conf.js
exports.config = {
  directConnect: false,
  framework: 'jasmine',
  specs: ['./spec/spec.js'],
  seleniumAddress: 'http://localhost:4444/wd/hub',

  multiCapabilities: [
    { 'browserName': 'chrome' },
    { 'browserName': 'firefox', 'marionette': true },
    { 'browserName': 'MicrosoftEdge' }
  ]
};

spec.js:

// spec.js
describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');

    expect(browser.getTitle()).toEqual('Super Calculator');
  });
});

Results:

[10:07:15] I/launcher - 0 instance(s) of WebDriver still running
[10:07:15] I/launcher - chrome #01 passed
[10:07:15] I/launcher - MicrosoftEdge #21 passed
[10:07:15] I/launcher - firefox #11 passed