Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs server error with selenium-webdriver

Getting below error when starting nodejs server with selenium webdriver

ubuntu@ip-10-10-10-193:~/testenvoy$ node app.js
/home/ubuntu/testenvoy/node_modules/selenium-webdriver/index.js:115
  static createSession(...args) {}
                       ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/ubuntu/testenvoy/controllers/test/all.js:2:17)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
r?

How can I fix this error?

UPDATE

After downgrade nodejs version to Node v6.9.0, I am getting below error

/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/promise.js:2517
        throw error;
        ^

WebDriverError: Firefox option was set, but is not a FirefoxOption: {}
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'WIN-MT0KFAH3HJN', ip: '10.10.10.10', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_112'
Driver info: driver.version: FirefoxDriver
    at WebDriverError (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
    at Function.createSession (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/firefox/index.js:640:55)
    at createDriver (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/index.js:167:33)
    at Builder.build (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/selenium-webdriver/index.js:629:16)
    at Query._callback (/home/ubuntu/www.testenvoy.com/webdriver/controllers/test/all.js:18:9)
    at Query.Sequence.end (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)
    at Query._handleFinalResultPacket (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/mysql/lib/protocol/sequences/Query.js:144:8)
    at Query.EofPacket (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/mysql/lib/protocol/sequences/Query.js:128:8)
    at Protocol._parsePacket (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/mysql/lib/protocol/Protocol.js:280:23)
    at Parser.write (/home/ubuntu/www.testenvoy.com/webdriver/node_modules/mysql/lib/protocol/Parser.js:74:12)
like image 627
Gohel Kiran Avatar asked Nov 08 '16 17:11

Gohel Kiran


Video Answer


2 Answers

npm i [email protected] did the trick for me.

P.S. also consider fixing that in your package.json if you have any.

like image 161
Ilya Kantor Avatar answered Oct 05 '22 11:10

Ilya Kantor


Check your node version, you should be using version 6:

node --version

To install the latest node use:

nvm install v6.9.0
nvm use 6.9.0
like image 37
ClickThisNick Avatar answered Oct 05 '22 12:10

ClickThisNick