9
votes

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

2
Is FireFox opening at all?Helmut Granda
I would also recommend to try to get Chrome running with all the help you have found, then move over to FireFox. At least with the help out there you should be able to get a stable environment and then shift to FF if you need to.Helmut Granda
Yes, FF opens briefly but then closes. Most of our users are on FF so that's why I' m not using Chrome.TesterMcTesterson

2 Answers

13
votes

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

npm install [email protected]
0
votes

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.