Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Quality Assurance Introduction to Selenium Test Drive Selenium Installation

Evan N
Evan N
3,244 Points

I am returning an error after I create "const driver = new selenium.Builder().forBrowser("chrome").build();" in noderepl

Hi everyone, I am running into a problem within my node repl on MacOS where it throws back an ECONNREFUSED with the specified port. Is there an easy workaround for this? In the meantime, I am going to google the exact error.

Thank you all,

> const driver = new selenium.Builder().forBrowser("chrome").build();
undefined
> /Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/lib/promise.js:2634
        throw error;
        ^

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:55130
    at ClientRequest.<anonymous> (/Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/http/index.js:238:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1278:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
From: Task: WebDriver.createSession()
    at Function.createSession (/Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
    at Function.createSession (/Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/chrome.js:761:15)
    at createDriver (/Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/index.js:170:33)
    at Builder.build (/Users/evan/Documents/Treehouse/Selenium/node_modules/selenium-webdriver/index.js:642:16)
    at repl:1:60
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:340:29)
    at bound (domain.js:280:14)
'''

5 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hmm... I noticed in another post you had Selenium already set up for Python. Stab in the dark here but, is it possible you have an environment variable set? That port seems fishy.

Try typing env in your console and look for any variable that starts with SELENIUM_.

Evan N
Evan N
3,244 Points

Hmm, I ran env and searched for anything that started with "SELENIUM" so that doesn't seem to be the case. Also, when I run my python selenium commands, I always specify the path where chromedriver is located.

I went ahead and updated my version of chromedriver to the latest via npm and that resolved the issue, yay แถ˜ แต’แดฅแต’แถ…

ChromeDriver 2.32.498537

Hi Evan,

How did you update chromedriver to the latest via npm? I tried npm install chromedriver --chromedriver_version=LATEST but it still shows old version ChromeDriver 2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067)

Please advise. Thank you

Evan N
Evan N
3,244 Points

Hi there, I originally had chromedriver installed as the executable on my machine and would run a local test by pointing to that file e.g. --local_driver_path="/Users/evan/Documents/Webdriver/chromedriver"

Meaning that if I ran the command chromedriver --version my system would not recognize this command (note that I am using Mac OS)

I am new to npm but for me when I installed chromedriver via npm it brought me to the latest version so that I could use it for this treehouse course.

Hi,

I found out that I need to delete the chromedriver files in the following locations after running command "where chromedriver"

C:\Jars\chromedriver.exe C:\Users\Tom\AppData\Roaming\npm\chromedriver C:\Users\Tom\AppData\Roaming\npm\chromedriver.cmd

Evan N
Evan N
3,244 Points

Thanks for sharing, perhaps this will help anyone else if they run into issues while attempting to use the latest version.

Perhaps using something like chromedriver_version=LATEST could help during installation. More information on that here under "versioning" https://www.npmjs.com/package/chromedriver

The answer is somewhere in here, but I can't fully figure it out: https://github.com/giggio/node-chromedriver/issues/90

Bas van Laarhoven
Bas van Laarhoven
3,960 Points

Use the code on this page https://www.npmjs.com/package/chromedriver it started selenium for me and I worked from there