6

I like to use Selenium chromewebdriver for testing an application.

I started with this Tutorial: https://code.google.com/p/selenium/wiki/WebDriverJs#Getting_Started

I downloaded newest webdriver and added it to path, then I tried to execute the sample code you see under getting started. I added the code to a script and tried to execute it with > node script.js and got the following error message:

undefined:1178
vlog(2, () => this + ' scheduling notifications', this);
         ^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:1123:19)
at Object.goog.loadModule (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:1085:46)
at C:\nodescripts\node_modules\selenium-webdriver\lib\webdriver\promise.js:1:6
at Object.exports.runInContext (vm.js:64:17)
at Object.Context.closure.goog.retrieveAndExecModule_ (C:\nodescripts\node_modules\selenium-webdriver\_base.js:135:8)
at <anonymous>:1:6
at Object.exports.runInContext (vm.js:64:17)
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (C:\nodescripts\node_modules\selenium-webdriver\_base.js:104:12)
at Object.goog.importScript_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:879:9)
at Object.goog.importModule_ (C:\nodescripts\node_modules\selenium-webdriver\lib\goog\base.js:900:14)
4
  • we have since migrated our documentation to GitHub. try again using the updated documentation and see if it works for you. really not sure if there's much difference, but worth a try Commented Oct 30, 2015 at 12:28
  • thanks i tryed it like in the updated documantation but still have the same error. I tried out when the error happen, it happens when i try to require webdriver: test = require('selenium-webdriver/testing')... Commented Oct 30, 2015 at 12:44
  • sorry - i'm not too familiar with the js bindings. you may want to raise an issue but you will want to read the requirements. Commented Oct 30, 2015 at 13:43
  • I've logged this github.com/SeleniumHQ/selenium/issues/1286 Commented Nov 19, 2015 at 18:01

4 Answers 4

10

There is a bug @version 2.48.0. I tried both on win and on linux and saw the same error message. Try using version 2.47.0.

npm install [email protected]

Update: Update your node.js.

https://nodejs.org/download/release/latest/

Sign up to request clarification or add additional context in comments.

2 Comments

This worked for me. My error message was "undefined:1190 vlog(2, () => this + ' scheduling notifications', this)"
Better to update node.js as OlliS suggested. v5.0.0 node works fine for me after i got this error line 1190 initially
6

For those who get this error and want to use the newer selenium-webdriver version:

Try updating your Node.js version. I was getting the same error -> after updating to v4.2.2 this error does not occur anymore.

Comments

6

According to pull request https://github.com/angular/protractor/pull/2736

I've updated protractor and it worked for me.

npm install -g protractor@2

webdriver-manager update --standalone

1 Comment

This solved it for me. First run "npm uninstall -g protractor" and then "npm install -g protractor@2". Thank you.
1

I was having this issue as well. On selenium-webdriver's site, they state that if you are using the 12.x line of node, you must use the --harmony flag. Doing so solved the problem for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.