Selenium webdriver exits with error code 135

老子叫甜甜 提交于 2019-12-20 17:40:55

问题


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.


回答1:


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.




回答2:


You can also add these lines to your conf.js file:

chromeOnly: true,
directConnect: true,



回答3:


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



回答4:


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.




回答5:


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

  1. try webdriver-manager update --standalone

Solution 2

  1. Remove previous instance (.jar file) of web driver from the location- C:\Users\HP\AppData\Roaming\npm\node_modules\p rotractor\selenium
  2. Download the selenium-server-standalone-2.45.0 from http://www.seleniumhq.org/download/ and replace the .jar file.



回答6:


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




回答7:


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.




回答8:


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,


来源:https://stackoverflow.com/questions/39353859/selenium-webdriver-exits-with-error-code-135

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!