[email protected]:karma-t01$ protractor protractor.conf.js [launcher] Process exited with error code 1 undefined:1190 vlog(2, () => this + ‘ scheduling notifications‘, this); ^ SyntaxError: Unexpected token ) at goog.loadModuleFromSource_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19) at Object.goog.loadModule (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46) at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6 at Object.exports.runInContext (vm.js:64:17) at Object.Context.closure.goog.retrieveAndExecModule_ (/home/y/.npm-packages/lib/node_modules/protractor/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 (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:104:12) at Object.goog.importScript_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:879:9) at Object.goog.importModule_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:900:14) [email protected]:karma-t01$
[email protected]:karma-t01$ npm install -g protractor[email protected]:karma-t01$ protractor --versionVersion 3.0.0
原因:https://github.com/angular/protractor/issues/2731
Protractor 3.x.x
no longer supports node < 4.2
BREAKING CHANGE: 1) Users will no longer be able to use node versions <4. 2)
You‘ll need to keep using the 2.x.x
version of protractor or upgrade the version of node you are using.
下载 https://nodejs.org/download/rc/v4.2.2-rc.2/
node-v4.2.2-rc.2.tar.gz
源码进行手动安装:
[email protected]:my_download$ tar -zxvf node-v4.2.2-rc.2.tar.gz
[email protected]:my_download$ cd node-v4.2.2-rc.2/
[email protected]:node-v4.2.2-rc.2$ ./configure
[email protected]:node-v4.2.2-rc.2$ make (编译需要大约十五分钟)
[email protected]:node-v4.2.2-rc.2$ make install
出现以下问题:
make -C out BUILDTYPE=Release V=1 make[1]: 正在进入目录 `/home/y/my_download/node-v4.2.2-rc.2/out‘ make[1]: 没有什么可以做的为 `all‘。 make[1]:正在离开目录 `/home/y/my_download/node-v4.2.2-rc.2/out‘ ln -fs out/Release/node node /usr/bin/python tools/install.py install ‘‘ ‘/usr/local‘ installing /usr/local/bin/node Traceback (most recent call last): File "tools/install.py", line 213, in <module> run(sys.argv[:]) File "tools/install.py", line 207, in run if cmd == ‘install‘: return files(install) File "tools/install.py", line 133, in files action([‘out/Release/node‘ + exeext], ‘bin/node‘ + exeext) File "tools/install.py", line 79, in install def install(paths, dst): map(lambda path: try_copy(path, dst), paths) File "tools/install.py", line 79, in <lambda> def install(paths, dst): map(lambda path: try_copy(path, dst), paths) File "tools/install.py", line 70, in try_copy try_unlink(target_path) # prevent ETXTBSY errors File "tools/install.py", line 33, in try_unlink os.unlink(path) OSError: [Errno 13] Permission denied: ‘/usr/local/bin/node‘ make: *** [install] 错误 1
根据错误信息:
OSError: [Errno 13] Permission denied: ‘/usr/local/bin/node‘
可知是权限问题,重新安装:
[email protected]:node-v4.2.2-rc.2$ sudo make install
测试:
[email protected]:node-v4.2.2-rc.2$ node --version
v4.2.2
[email protected]:node-v4.2.2-rc.2$
再次运行protractor
[email protected]:karma-t01$ protractor protractor.conf.js Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://192.168.0.177:53829/wd/hub /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:108 var template = new Error(this.message); ^ UnknownError: unknown error: Chrome version must be >= 43.0.2357.0 (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.0-24-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.62 seconds Build info: version: ‘2.48.2‘, revision: ‘41bccdd‘, time: ‘2015-10-09 19:59:12‘ System info: host: ‘y‘, ip: ‘127.0.1.1‘, os.name: ‘Linux‘, os.arch: ‘amd64‘, os.version: ‘3.13.0-24-generic‘, java.version: ‘1.7.0_55‘ Driver info: org.openqa.selenium.chrome.ChromeDriver at new bot.Error (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:108:18) at Object.bot.response.checkResponse (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:109:9) at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24 at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14) at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14) at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21) at goog.async.run.processWorkQueue (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/run.js:124:15) at process._tickCallback (node.js:368:9) From: Task: WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22) at Function.webdriver.WebDriver.createSession (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30) at [object Object].Builder.build (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:445:22) at [object Object].DriverProvider.getNewDriver (/home/y/.npm-packages/lib/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7) at [object Object].Runner.createBrowser (/home/y/.npm-packages/lib/node_modules/protractor/lib/runner.js:186:37) at /home/y/.npm-packages/lib/node_modules/protractor/lib/runner.js:276:21 at _fulfilled (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js:797:54) at self.promiseDispatch.done (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js:826:30) at Promise.promise.promiseDispatch (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js:759:13) at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js:573:44 [launcher] Process exited with error code 1 [email protected]:karma-t01$
可以发现之前的错误已经解决,但是提示:
UnknownError: unknown error: Chrome version must be >= 43.0.2357.0 下面需要升级Chrome浏览器
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - $ sudo sh -c ‘echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list‘
$ sudo apt-get update $ sudo apt-get install google-chrome-stable
$ google-chrome & [or] $ google-chrome-stable &
[email protected]:karma-t01$ protractor protractor.conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.177:60148/wd/hub
Started