Protractor + CucumberJS Error after update: cucumber.js:150:36 - selenium-webdriver

I'm bringing this into discussion here, since I had started this conversation over GithubIssue 2630, Basically I'm having problems with the integration of Protractor and Cucumber, I had even tried to downgrade to a older versions for both but the same thing happens, here's an explanation of what I did so far:
I had uninstalled everything and started from scratch. I started by installing Protractor, Cucumber and Webdriver globally and I can see this error, same as before, when I run the protractor command.
$ protractor conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.104:64737/wd/hub
[launcher] Error: TypeError: undefined is not a function
at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:150:36
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:650:9)
at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:147:14
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:525:49
at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
[launcher] Process exited with error code 100
```
Then I've installed all locally, running npm install, and I got this error
[launcher] Process exited with error code 1
/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:126
throw e;
^
Error: No selenium server jar found at the specified location (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar). Check that the version number is up to date.
at LocalDriverProvider.addDefaultBinaryLocs_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/driverProviders/local.js:37:11)
at LocalDriverProvider.setupEnv (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/driverProviders/local.js:71:8)
at Runner.run (/Users/brunosoko/Documents/Dev/Personal/olapic-test2/node_modules/protractor/lib/runner.js:261:31)
at TaskRunner.run (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/taskRunner.js:123:19)
at createNextTaskRunner (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/launcher.js:223:20)
at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/launcher.js:246:7
at _fulfilled (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:759:13)
at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:573:44
Which I resolved by installing locally webdriver ./node_modules/.bin/webdriver-manager update
Then I ran ./node_modules/.bin/protractor conf.js and I'm getting the same error as above, for cucumber.js:150:36
Later, I tried to uninstall globally framework, npm uninstall -g protractor and npm uninstall -g cucumber
But the same error happens! I'm not sure what am I doing wrong!

I'm not sure what is wrong with your specific situation, but I have created a bare minimum example of cucumber 0.8.1 working with the yet to be released version of protractor here - https://github.com/darrinholst/protractor-cucumber-example. Hope this helps.
git clone https://github.com/darrinholst/protractor-cucumber-example
cd protractor-cucumber-example
npm install
npm test

Related

protractor not starting selenium

I am encounteing following error when starting an end to end test using protractor.
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$ ./node_modules/protractor/bin/protractor ./conf.js
[16:29:47] I/launcher - Running 1 instances of WebDriver
[16:29:47] I/direct - Using ChromeDriver directly...
[16:29:47] E/launcher - EINVAL: invalid argument, uv_interface_addresses
[16:29:47] E/launcher - Error: EINVAL: invalid argument, uv_interface_addresses
at Error (native)
at getLoInterface (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:30:20)
at getAddress (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:46:14)
at Object.exports.getLoopbackAddress (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:85:10)
at resolveCommandLineFlags.then.args (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/remote/index.js:240:24)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at Function.createSession (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/chrome.js:709:29)
at Direct.getNewDriver (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/driverProviders/direct.ts:90:25)
at Runner.createBrowser (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/runner.ts:391:27)
at _fulfilled (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:796:13)
at /mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:137:13)
[16:29:47] E/launcher - Process exited with error code 199
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$
I could be because of issue in starting webdriver. I tried to run selenium but I got following error
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$ ./node_modules/protractor/bin/webdriver-manager start
[16:27:55] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.32 -Dwebdriver.gecko.driver=/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.18.0 -jar /mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.5.3.jar -port 4444
[16:27:55] I/start - seleniumProcess.pid: undefined
[16:27:55] W/start - Selenium Standalone server encountered an error: Error: spawn java ENOENT
I have tried cleaning and restarting using clean and start options with webdriver-manager but that hasn't solved the problem
Update---
I am running this on Windows machine through Bash for Windows. The issue with starting Selenium is Bash cannot find Java. I exported Path but because Java is installed in Program Files, I am unable to set the path in Bash as Bash is unable to process the space in Program Files. I could run the selenium server on CMD where JAVA path is set. The problem is still not resolved though.
It seems the issue was I didn't install correctly the first time. I should have run webdriver-manager update from home directory. I cleaned up using webdriver-manger clean and re-run webdriver-manger start from project's home directory project home> .\node_modules\protractor\bin\webdriver-manager start. Probably the installation sets some paths which get messed up if some other directory is used. I also started protractor from project's home directory >node .\node_modules\protractor\bin\protractor .\protractor.conf.js

Unable to start webdriver-manager on mac to test angular apps on protractor

I am new to protractor. While starting the Selenium Server using webdriver-manager in protractor I am getting the following error
[19:32:29] I/start - java Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.31 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.18.0 -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.5.0.jar -port 4444
[19:32:29] I/start - seleniumProcess.pid: 823 Error: Unable to access jarfile /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.5.0.jar
[19:32:29] I/start - Selenium Standalone has exited with code 1
AgIwals-MacBook-Pro:angulartestingprotractor agiwal$ Error: Unable to access jarfile /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.5.0.jar
My protractor version is 5.1.2 and my npm version is 3.10.10. Can somebody help me with this error?
Looks like you need to update webdriver-manager - a new version was released yesterday so your timing is coincidental. You can also see the language bindings release dates here: http://docs.seleniumhq.org/download/. And since you mentioned you're on Protractor v5+, you should also confirm that your node (not npm) version is v6+.
You simply need to run webdriver-manager update -- personally I like to avoid potential driver/version conflicts by cleaning out any old downloads via webdriver-manager clean, but that's up to you (run the update after clean).

why webdriver-update command not found although protractor is installed ?

why webdriver-update command not found although protractor is installed ?
i installed protractor node as
sudo npm install protractor -g
and when i try to make
sudo webdriver-manager update
it return with
sudo: webdriver-manager: command not found
i tried also to install it manually but i failed to do.
tamer#tamer-Inspiron-N5110:/media/tamer/Work/conFusion/test$ protractor protractor.conf.js
[15:23:48] I/direct - Using ChromeDriver directly...
[15:23:48] I/launcher - Running 1 instances of WebDriver
[15:23:48] E/direct - Error code: 135
[15:23:48] E/direct - Error message: Could not find chromedriver at /home/tamer/.npm-global/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22
[15:23:48] E/direct - Error: Could not find chromedriver at /home/tamer/.npm-global/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22
at Direct.getNewDriver (/home/tamer/.npm-global/lib/node_modules/protractor/built/driverProviders/direct.js:65:27)
at Runner.createBrowser (/home/tamer/.npm-global/lib/node_modules/protractor/built/runner.js:198:43)
at /home/tamer/.npm-global/lib/node_modules/protractor/built/runner.js:277:30
at _fulfilled (/home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:137:13)
at flush (/home/tamer/.npm-global/lib/node_modules/protractor/node_modules/q/q.js:125:13)
at nextTickCallbackWith0Args (node.js:420:9)
[15:23:48] E/launcher - Process exited with error code 135
tamer#tamer-Inspiron-N5110:/media/tamer/Work/conFusion/test$ sudo webdriver-manager update
[sudo] password for tamer:
sudo: webdriver-manager: command not found
Root Causes of your issue might Node REPL unable to pick up the installed node_module
Can you try one of below and see
In order to make modules available to the Node.js REPL, it might be useful to add <</usr/lib>>/node_modules folder to the $NODE_PATH environment variable.
Refer here for more info
Goto .\node_modules\protractor\bin and execute the webdriver-manager trigger script directly.
node webdriver-manager update

"Runtime.executionContextCreated has invalid 'context" error when i run Protractor

I am getting this below Error while i run my protractor. And below is the error as shown in my webstorm console.
"C:\Program Files (x86)\JetBrains\WebStorm 2016.2\bin\runnerw.exe"
"C:\Program Files\nodejs\node.exe"
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\built\cli.js
C:\Users\x216526\workspace_Protractor\SWA_Protractor\conf.js
[17:59:58] I/direct - Using ChromeDriver directly... [17:59:58]
I/launcher - Running 1 instances of WebDriver [18:00:01] E/launcher -
session not created exception from unknown error:
Runtime.executionContextCreated has invalid 'context':
{"auxData":{"frameId":"9784.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2824.0) (Driver info:
chromedriver=2.22.397933
(1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT
6.1.7601 SP1 x86_64) [18:00:01] E/launcher - SessionNotCreatedError: session not created exception from unknown error:
Runtime.executionContextCreated has invalid 'context':
{"auxData":{"frameId":"9784.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2824.0) (Driver info:
chromedriver=2.22.397933
(1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT
6.1.7601 SP1 x86_64) at WebDriverError (c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:26:26)
at SessionNotCreatedError
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:307:26)
at Object.checkLegacyResponse
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:639:15)
at parseHttpResponse
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:538:13)
at
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:472:11
at ManagedPromise.invokeCallback_
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2820:25
at
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
From: Task: WebDriver.createSession() at Function.createSession
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Driver
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:778:38)
at Direct.getNewDriver
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\direct.js:68:26)
at Runner.createBrowser
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\built\runner.js:187:43)
at
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\built\runner.js:261:30
at _fulfilled
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
at
c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle
(c:\Users\x216526\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13)
[18:00:01] E/launcher - "process.on('uncaughtException'" error, see
launcher [18:00:01] E/launcher - Process exited with error code 199
Process finished with exit code 199
My config js look like below:
exports.config = {
directConnect: true, // Capabilities to be passed
//to the webdriver instance.
capabilities: { 'browserName': 'chrome', },
framework: 'jasmine2',
specs: ['./src/sli_sanitytests/San1_Check_
Sli_Homepage_is_Accessible_spec.js',
'./src/sli_sanitytests/San2_
Click_createButton_to_Open_Sli_CreateForm_page_spec.js',
'./src/sli_sanitytests/San3_
Create_Sli_reference_spec.js' ],
suites: {
smoke: ['./smoke/!*.spec.js'],
regression:['./regression/!*.spec.js'],
functional: ['./functional/!*.spec.js'],
all: ['./!*!/!*.spec.js'],
selected:['./functional/addcustomer.spec.js',
'./regression/openaccount.spec.js'],
},
// Options to be passed to Jasmine
jasmineNodeOpts: {
//onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true, // If true,print colors to the terminal.
showColors: true, // If true, include stack traces in
//failures.
includeStackTrace: true, // Default time to wait in ms
//before a test fails.
defaultTimeoutInterval: 80000
},
//enter code here
onPrepare:function() {
browser.ignoreSynchronization = true;
browser.driver.manage().window().maximize();
},
}
2016-10-13: ChromeDriver v2.24 has been released which supports Chrome v52-54. (Thanks #Anton)
2016-08-16: One of the recent updates to the Chrome Dev channel introduced a bug preventing ChromeDriver from properly starting. Having just worked around the same problem, I would suggest backing up your data and reverting to the Beta or Stable release channel of Chrome. See the Chrome Release Channels for more details on safely switching.
Alternatively, switching to the Dev version of ChromeDriver should also fix the issue. From a closed issue on the chromedriver project:
There are some Devtool changes in Chrome dev channel v54 which is not currently supported in Chromedriver stable v2.23.
You may want to use dev version of Chromedriver which has the fix. It can be downloaded from chromedriver…/continuous/….zip
Review the issue for the full link.
If the latest protractor is not having the latest chromedriver then to update it using webdriver-manager follow these below steps
enter latest chromedriver version in file config.json this file is present under path /node_modules/protractor/node_modules/webdriver-manager/built
optional (and change 'mac32' to 'mac64' in file 'chrome_driver.js' which is present under path /webdriver-manager/built/lib/binaries)
run webdriver-manager update in the console.
hint: To get the path of 'webdriver-manager' folder observe the console after command webdriver-manager update
Since I got the same issue and found this question, I'd like to add a bit more context: it is indeed a version problem between an 'old' chrome driver (2.22 in my case) and a 'newer' chrome release (54 in my case) like Sean answered.
However there is no need to fiddle manually with config files or downloads.
Instead just run
npm update protractor -g
To update protractor globally then
webdriver-manager update
To update the chrome driver. The newer chrome driver v2.25 is not yet included in the protractor package at the time of writing (you will get v2.24 instead) but it works fine with Chrome 54. Protractor is v4.09 at the time of writing. The same trick should work for future versions too!
After big battle with above issue i have found the solution for it. So please
don`t do anything.
First of all uninstall your chrome browser and reinstall it. That`s it protractor will not throw any such errors.
I even don`t know why this happened and for what reasons looks bit strange but yes the only solution is uninstall the chrome browser and reinstall it.
npm uninstall webdriver-manager -g
npm install webdriver-manager -g
I have the same problem with 2.24 version. In order to fix this bug download chromedriver.exe with version 2.25, it's available now by link https://sites.google.com/a/chromium.org/chromedriver/downloads
Try to reinstall webdriver-manager
npm uninstall webdriver-manager -g
npm install webdriver-manager -g
Issue was fixed for me after I installed webdriver-manager: 10.2.8
This is common issue, I faced it many times.
I use chromedriver in my selenium framework once in month and I usually get this type of error.
Follow below steps:
Unistall/Remove all existing chromedriver.
Install latest
chromedriver from official google site.
Set system path to chromedriver.exe folder (So you don't need to bother about setting the system path from code)
Restart the IDE (If already running)
ENJOY !
I updated to Chrome Driver 2.25 which fixed the problem for me. This is a simple update:
Download the latest version from: https://sites.google.com/a/chromium.org/chromedriver/downloads
Unzip the contents (it's one file "chromedriver.exe").
Copy that over your existing chromedriver.exe
For me that was at: \node_modules\protractor\selenium
That's it. I reran the tests and the pesky error went away.
First of all uninstall your chrome browser and reinstall it. That`s it protractor will not throw any such errors.
I even don`t know why this happened and for what reasons looks bit strange but yes the only solution is uninstall the chrome browser and reinstall it.
npm uninstall webdriver-manager -g npm install webdriver-manager -g

Protractor 0.16.1 e2e AngularJS - Starting selenium standalone server... events.js:72 Error: spawn ENOENT

Attempted Project: https://github.com/yearofmoo/angularjs-seed-repo
Environment:
Windows 7 64-bit
NodeJS v 0.10.24
Protractor v 0.16.1
grunt v0.4.2
grunt-cli v0.1.11
Notes:
For selenium, install_selenium_standalone has been replaced by webdriver-manager binary around 12/2/13 according to [Julie's post][1]. This seems to be related to the issue.
Also, git must be installed in the project directory and npm install must be run using Git Bash in Windows.
Error in Git Bash:
$ grunt test:e2e --debug
Running "connect:testserver" (connect) task
[D] Task source: c:\nodejs-0.10.24\node_modules\grunt-contrib-connect\tasks\conn
ect.js
Started connect web server on 127.0.0.1:9999.
Running "protractor:singlerun" (protractor) task
[D] Task source: c:\nodejs-0.10.24\node_modules\grunt-protractor-runner\tasks\pr
otractor_runner.js
Starting selenium standalone server...
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
>
Fatal error: protractor exited with code: 8
Java is required to run selenium, so it seems You don't have any.

Resources