TypeError: Cannot call method 'forEach' of null Error
I'm getting this error when call protractor tests\protractor-conf.js. What is this? How to fix it, how to make Protractor to run my tests?
C:\www\app.foo>protractor tests\protractor-conf.js
Using ChromeDriver directly...
C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\index.js:48
interfaces[key].forEach(function(ipAddress) {
^
TypeError: Cannot call method 'forEach' of null
at getAddress (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\index.js:48:21)
at Object.exports.getLoopbackAddress (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\index.js:78:10)
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:186:17
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1
531:20)
at notify (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:354:12)
at then (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:406:7)
at Object.webdriver.promise.when (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:631:18)
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:172:20
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js
:131:49)
at Function.webdriver.WebDriver.createSession (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:1
11:30)
at Object.createDriver (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:460:30)
at ChromeDriverProvider.getDriver (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\chrome.js:67:27)
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:207:35
at _fulfilled (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:525:49
I'm having the same issue with chrome only mode. If I run a standalone selenium server it runs fine. It worked with 0.23.1
Thanks, P
How to run a standalone selenium server?
The Getting Started instructions page explains - look at the webdriver-manager command in your Node command prompt. Then set the seleniumUrl in your config and set chromeOnly=false.
Have you updated Chromedriver to 2.10?
I doubled checked and I've got Chromedriver 2.10 and Selenium 2.42.0.
@juliemr: I have: ChromeDriver 2.10.267521 selenium-server-standalone-2.42.0.jar
@penfold:
chromeOnly: false did the job. Thank you.
Here is my Protractor config file if someone is interested:
exports.config = {
allScriptsTimeout: 11000,
seleniumAddress: 'http://localhost:4444/wd/hub',
chromeDriver: 'C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\protractor\\selenium',
chromeOnly: false, <-- this option was "true"
specs: [
'e2e/spec/*Suit.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:3000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
Can you post the config that broke?
I have the same issue. It works fine in my local mac machine, but this error happen on a windows CI server. Both chromedriver 2.10 and 2.9 have the same issue.
Maybe an issue with selenium-webdriver 2.42.0 on windows?
Looking at the recent changes to the selenium-webdriver. There looks to be a possible fix that will appear in the next release (after 2.42.2).
See https://code.google.com/p/selenium/source/detail?r=9779366828b293420f1950bf3fd2e768fbb365b5
selenium-webdriver is intentionally only looking at darwin and linux systems to find the local loopback address (typically 127.0.0.1). So it's not working on windows. To run the angular-phonecat project, I had to edit angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\net\index.js to make getAddress(loopback, opt_family) simply return "127.0.0.1" (all other logic removed) to work around this issue.
@penfold @wzup thank you both of you, the solution is indeed starting a standalone selenium server and configuring the protractor-conf.js file. I managed to run protractor too this way. Thanks again.
@penfold @JeffreyVest Editing the index.js file as per https://code.google.com/p/selenium/source/detail?r=9779366828b293420f1950bf3fd2e768fbb365b5 was the only thing that worked for me(Win 8.1)
changing chromeOnly from true to false (chromeOnly: false) in protractor config file did it for me (win7 os) thnx @wzup @penfold
chromeOny didn't work for me, I solved the issue by updating the version of protractor and karma in the package.json to the latest versions and explicitly add karma-jasmine dependancy
I solved the issue by updating the version of protractor and karma in the package.json to the latest versions and explicitly add karma-jasmine dependancy
documented it in the duplicate bug ticket here -> https://github.com/angular/angular-phonecat/issues/176
It looks like these are all solved by updating to new version of selenium-webdriver. Closing, please open a new issue if you continue to see errors.