Protactor error, Unexpected token )

2020-06-03 01:36发布

I was about start learning protractor and following the simple tutorial in there http://www.protractortest.org/#/tutorial

but unfortunately getting weird error after run this command protractor conf.js

[launcher] Process exited with error code 1
   /usr/local/lib/node_modules/protractor/node_modules/q/q.js:126
       throw e;
SyntaxError: Unexpected token )
  at goog.loadModuleFromSource_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
  at Object.goog.loadModule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
  at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6
  at Object.Context.closure.goog.retrieveAndExecModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:135:8)
  at <anonymous>:1:6
  at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:104:12)
  at Object.goog.importScript_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:879:9)
  at Object.goog.importModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:900:14)
  at Object.goog.writeScripts_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1323:16)
  at Object.goog.require (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:663:14)

node version : v0.10.37

java version : 1.8.0_66

protractor : Version 3.0.0

jadmine : jasmine v2.3.2 jasmine-core v2.3.4

UPDATE

already clone the repository https://github.com/angular/protractor

run following command

./bin/webdriver-manager update --standalone

./bin/webdriver-manager start

open new terminal tab

change to website direcotry

run the website folder using npm start and the website already running on port 8080

open new terminal tab, still under website folder

run test command npm test then chrome browser open up in a few second and show same error above

1条回答
劫难
2楼-- · 2020-06-03 02:34

Protractor upgraded to WebDriver 2.48.2 with their release of version 3.0.0. This version of WebDriver is not compatible with Node.js versions < 4.

From CHANGELOG.md in the Protractor project:

(18e1f71) chore(webdriver): upgrade Protractor to webdriver 2.48.2

BREAKING CHANGE:
1) Users will no longer be able to use node versions < 4.
2) There are significant changes to the control flow, and tests may need to be modified to be compliant with the new control flow. See Changes

Downgrading Protractor to 2.5.1 or upgrading Node.js to >= v4.0.0 should solve your problem. See here for more info on breaking changes in Protractor v3.0.0.

查看更多
登录 后发表回答