TesterMcTesterson
TesterMcTesterson

Reputation: 91

Error from Selenium: UnhandledPromiseRejectionWarning: Error: ECONNREFUSED connect ECONNREFUSED

I am brand new to node.js and Selenium so please bear with me if I don't give all the details needed right away.

This is my very simple test which I want to run in FF (I found a lot of questions here like this but they refer to Chrome):

const webdriver = require('selenium-webdriver');

const builder = new webdriver.Builder();
builder.forBrowser('firefox');
const driver = builder.build();

driver.get('https://google.com');

driver.quit();

This is the error I keep getting:

(node:3534) UnhandledPromiseRejectionWarning: Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:62412 at ClientRequest. (/Users/name/training/learningnodejs/node_modules/selenium-webdriver/http/index.js:244:15) at ClientRequest.emit (events.js:160:13) at Socket.socketErrorListener (_http_client.js:389:9) at Socket.emit (events.js:160:13) at emitErrorNT (internal/streams/destroy.js:64:8) at process._tickCallback (internal/process/next_tick.js:152:19) (node:3534) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:3534) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Selenium version: 5.6.0

Upvotes: 9

Views: 6469

Answers (2)

Bob Aleena
Bob Aleena

Reputation: 450

I had a similar error but was trying to launch chrome. The solution for me was to install the chrome driver.

npm install chromedriver

It worked after that. I have not tried to do the same with geckodriver and firefox.

Upvotes: 0

Vitalii Fedoryshyn
Vitalii Fedoryshyn

Reputation: 325

Had the same issue. Installing of previous version of selenium-webdriver help for me.

npm install [email protected]

Upvotes: 14

Related Questions