Summary:
I am using Protractor v5.3.0 & Protractor-Cucumber-Framework v4.2.0 on Windows 10. I've put together a sample test project in Javascript using the WebStorm IDE. I have no trouble runnnig the sample test scenario using the Chrome browser. Yet when I try to use IE11 the same test scenario fails to run. Instead I see the following error message displayed on the WebStorm terminal window:
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2>node_modules\.bin\protractor cucumber.config.js
(node:17976) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[15:58:12] I/launcher - Running 1 instances of WebDriver
[15:58:12] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
F---
Failures:
1) Scenario: Protractor and Cucumber Test # features\testone.feature:7
× Given I go to "https://angularjs.org/" # features\step_definitions\testone.steps.js:73
JavascriptError: Error executing JavaScript
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: <computer name>, ip: <ip address>, os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.4'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: Protractor.get(https://angularjs.org/) - reset url
at thenableWebDriverProxy.schedule (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
at ProtractorBrowser.executeScriptWithDescription (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\protractor\built\browser.js:404
:28)
at driver.controlFlow.execute.then.then.then (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\protractor\built\browser.js:679:25)
at ManagedPromise.invokeCallback_ (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\promise.js:1376:14)
at TaskQueue.execute_ (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\promise.js:3084:14)
at TaskQueue.executeNext_ (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\promise.js:3067:27)
at asyncRun (C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\promise.js:2927:27)
at C:\Users\<user name>\<project name>\WebStorm\protractorCucumberTest_v2\node_modules\selenium-webdriver\lib\promise.js:668:7
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
- When I add "Be Awesome" in the task field # features\step_definitions\testone.steps.js:77
- And I click the add button # features\step_definitions\testone.steps.js:81
- Then I should see my new task in the list # features\step_definitions\testone.steps.js:86
1 scenario (1 failed)
4 steps (1 failed, 3 skipped)
0m00.250s
[15:58:29] I/launcher - 0 instance(s) of WebDriver still running
[15:58:29] I/launcher - internet explorerANY #01 failed 1 test(s)
[15:58:29] I/launcher - overall: 1 failed spec(s)
[15:58:29] E/launcher - Process exited with error code 1
In the newly opened IE window there is a can't reach this page error message.
I've reviewed numerous Stack Overflow posts, and elsewhere, on ths topic. So far I can't get IE 11 to work. Thanks for any help...
NB: Each time I run the test I see a different localhost port number appear in the newly opened IE window.
http://localhost:44234/
http://localhost:30821/
NB: I'm new to using JavaScript and Protractor, etc.
Detailed Notes:
All the required software has been installed locally to the project. I don't any versions of Protractor, etc. installed globally on the computer currently.
My WebStorm project structure is:
My package.json file is:
{
"name": "protractorCucumberTest_v2",
"version": "1.0.0",
"description": "To test Protractor and Cucumber Integration",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "tbd"
},
"keywords": [],
"author": "user name",
"license": "ISC",
"dependencies": {
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"cucumber": "^4.0.0",
"protractor": "^5.3.0",
"protractor-cucumber-framework": "^4.2.0"
}
}
My testone.feature file is:
#features/test.feature
Feature: Angular Task List
As a basic user
I should be able to add and remove tasks from the task list
So that I can keep track of my tasks
Scenario: Protractor and Cucumber Test
Given I go to "https://angularjs.org/"
When I add "Be Awesome" in the task field
And I click the add button
Then I should see my new task in the list
My testone.steps.js file is:
var {Given, Then, When} = require ('cucumber');
var chai = require('chai'),
expect = chai.expect,
chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
Given(/^I go to "([^"]*)"$/, function (site) {
return browser.get(site);
});
When(/^I add "([^"]*)" in the task field$/, function (task) {
return element(by.model('todoList.todoText')).sendKeys(task);
});
When(/^I click the add button$/, function () {
var el = element(by.css('[value="add"]'));
return el.click();
});
Then(/^I should see my new task in the list$/, function () {
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).to.eventually.equal(3);
return expect(todoList.get(2).getText()).to.eventually.equal('Do not Be Awesome');
});
My cucumber.config.js file is:
exports.config = {
capabilities: {
seleniumAddress: 'http://localhost:4444/wd/hub',
// browserName: 'chrome'
browserName: 'internet explorer',
ignoreProtectedModeSettings: true,
version: 'ANY'
},
localSeleniumStandaloneOpts : {
jvmArgs : ["-Dwebdriver.ie.driver=./node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer3.11.0.exe"],
},
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: [
'./features/*.feature'
],
cucumberOpts: {
require: ['./features/step_definitions/*.steps.js'],
tags: [],
strict: true,
dryRun: false,
compiler: []
},
onPrepare: function () {
browser.manage().window().maximize();
}
};
The command I use to start the web server is:
node_modules\.bin\webdriver-manager start --ie
The command I use to start the test run is:
node_modules\.bin\protractor cucumber.config.js
Software Version information:
npm: v5.5.1
node: v8.9.1
protractor: v5.3.0
protractor-cucumber-framework: v4.2.0
cucumber-js: v4.0.0
JDK: 9.0.4
JRE: 9.0.4
node_modules\.bin\webdriver-manager status
[15:22:42] I/status - selenium standalone version available: 3.11.0 [last]
[15:22:42] I/status - chromedriver version available: 2.36 [last]
[15:22:42] I/status - geckodriver version available: v0.19.1 [last]
[15:22:42] I/status - IEDriverServer version available: 3.11.0 [last]
[15:22:42] I/status - android-sdk is not present
[15:22:42] I/status - appium is not present
New Information as of 20 March 2018:
I have tried the following technology stack on my system:
- Protractor
- Jasmine Test Framework
- IE 11
- Windows 10
Using this setup I can get the IE 11 test to execute. But when I use the following setup on the same computer with largely the same software the IE 11 test will not work. Switching the test framework to Cucumber from Jasmine seems to be the key. We want to use Cucumber for our BDD test automation programme.
- Protractor
- Cucumber Test Framework (via Cucumber and protractor-cucumber-framework)
- IE 11
- Windows 10
For the Protractor / Jasmine test setup that now works with IE 11 the following code files form the basis of my project:
package.json
{
"name": "protractorJasmineTest",
"version": "1.0.0",
"description": "Trial replication of locally installed variant the project",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "tbd"
},
"keywords": [],
"author": "user name",
"license": "ISC",
"dependencies": {
"protractor": "^5.3.0"
}
}
protractor.config.js
exports.config = {
jvmArgs: ['-Dwebdriver.ie.driver=.\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer3.11.1.exe'],
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
multiCapabilities: [
{
browserName: 'internet explorer',
ignoreProtectedModeSettings: true,
version: 'ANY'
// ensureCleanSession : 'true'
// browserName: 'chrome'
}
],
specs: ['spec.js']
}
spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.manage().timeouts().pageLoadTimeout(30000);
browser.driver.get('https://angularjs.org');
expect(browser.driver.getTitle()).not.toEqual('Super Calculator');
});
});