Protractor e2e throwing webdriver is not defined
Asked Answered
C

2

6

I had my protractor running untill few days ago when i started encountering:

Using the selenium server at http://localhost:4444/wd/hub
 **** UNCAUGHT EXCEPTION ****
Error: connect ECONNREFUSED
    at exports._errnoException (util.js:682:11)
    at Object.afterConnect [as oncomplete] (net.js:947:19)
 ****************************
 **** UNCAUGHT EXCEPTION ****
Error: socket hang up
    at createHangUpError (_http_client.js:182:15)
    at Socket.socketCloseListener (_http_client.js:214:23)
    at Socket.EventEmitter.emit (events.js:120:20)
    at TCP.close (net.js:459:12)
 ****************************

on further digging using my custom callback method e.message printed:

Error:: webdriver is not defined

/home/workspace/desktop/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1702
      throw error;
            ^
ReferenceError: webdriver is not defined

I tried installing selenium web driver using npm install selenium-webdriver but this did not help, also tried npm install for protractor but nothing seems to work here

Any help in this regard is highly appreciated.

-Vaibhav

Coulomb answered 14/4, 2014 at 6:49 Comment(0)
C
0

I have found the solution to it however not very convinced about the reasoning. My node version was latest and when I switched to node version v0.10.26 the e2e protractor test cases started working again.

Coulomb answered 14/4, 2014 at 8:52 Comment(1)
Did you submit the issue on Protractor Github?Broadsword
H
6

I just ran into a similar issue, so I thought I'd share a solution I worked out.

After a little digging, I found a thread on accessing the current webdriver instance. Unfortunately, that doesn't give access to the actual webdriver object (it's just an instance of webdriver.WebDriver). What eventually worked for me was installing selenium-webdriver using npm and then putting this at the top of my test spec file:

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

I then had access to the webdriver namespace in that spec file.

Hasin answered 16/1, 2015 at 2:29 Comment(0)
C
0

I have found the solution to it however not very convinced about the reasoning. My node version was latest and when I switched to node version v0.10.26 the e2e protractor test cases started working again.

Coulomb answered 14/4, 2014 at 8:52 Comment(1)
Did you submit the issue on Protractor Github?Broadsword

© 2022 - 2024 — McMap. All rights reserved.