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

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

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).

Selenium webdriver exits with error code 135

I am new to protractor. I am getting the following error while trying to run Selenium tests using protractor
I/hosted - Using the selenium server at http://localhost:4444/wd/hub
I/launcher - Running 1 instances of WebDriver
E/launcher - Error code: 135
E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
at ClientRequest.<anonymous> (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:381:15)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:267:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1269:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
From: Task: WebDriver.createSession()
at Function.createSession (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Builder.build (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\built\driverProviders\driverProvider.js:37:33)
at Runner.createBrowser (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\built\runner.js:187:43)
at c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\built\runner.js:261:30
at _fulfilled (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
at c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13)
E/launcher - Process exited with error code 135
I checked to see if any other process is listening to port 4444, but did not find any. also I am running web driver with --standalone flag.
It seems like selenium server is not running on http://127.0.0.1:4444/wd/hub. Before running your protractor test,you must start the selenium server using below command.webdriver-manager start. After starting the server your tests will execute without any errors.
If you dont want to start selenium server manually,then just remove seleniumAddress:http://localhost:4444/wd/hub property from your conf.js.
You can also add these lines to your conf.js file:
chromeOnly: true,
directConnect: true,
Start the webdriver, its good to update the web driver and start the web driver before you start executing your automation test suite by executing the below commands in console screen.
webdriver-manager update
webdriver-manager start
Do you have selenium drivers installed for the browser you want to test with?
Try with
webdriver-manager update
It will take care of installing the drivers for you. You just need to run it once, if you call it again it will see that the drivers are already installed and will not procede.
Did you start selenium server using this command webdriver-manager start?
If not there might be a problem with your configuration with selenium server.
I would suggest follow this thread
Solution 1
try webdriver-manager update --standalone
Solution 2
Remove previous instance (.jar file) of web driver from the location- C:\Users\HP\AppData\Roaming\npm\node_modules\p rotractor\selenium
Download the selenium-server-standalone-2.45.0 from http://www.seleniumhq.org/download/ and replace the .jar file.
i also get this type of error, but after set environment variables this issue is solved.
location of the npm;
Example:
C:\Users\AppData\Roaming\npm
The directConnect solution is nice when running protractor locally, but it didn't work when trying to do it on Jenkins. It seems like when running everything in Docker containers in Jenkins, you'll have to start webdriver-manager start in detached mode -d first, wait, and then start protractor.
check your web driver status by the below command
webdriver-manager status
if it's not up to date you can remove and install it by following these steps
webdriver-manager clean
webdriver-manager status
webdriver-manager update
webdriver-manager start
then start your web driver by
if you get this error
ERROR [BaseServer.start] - Port 4444 is busy, please choose a free port and specify it using -port option
you can set another port by this command(for example port 4545)
webdriver-manager start --seleniumPort 4545
then your selenium web driver will run
I have run the windows command prompt as administrator and solved this problem. I am not seeing this problem anymore.
And I added also
chromeOnly: true,
directConnect: true,

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

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

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