量角器无法运行我的脚本

时间:2018-07-30 04:52:16

标签: google-chrome ubuntu webdriver protractor

我只是尝试运行我的第一个量角器,所以我只是从here那里获取代码

我在eclipse中编写代码,我也将tern项目转换为cd,然后将其cd到我的项目中,然后输入此代码

protractor conf.js 

然后我收到此错误

(node:9552) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[10:17:07] I/launcher - Running 1 instances of WebDriver
[10:17:07] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[10:17:07] E/launcher - unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-29-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'groot', ip: '192.168.2.8', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-29-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
[10:17:07] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-29-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'groot', ip: '192.168.2.8', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-29-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
    at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:761:15)
    at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:170:33)
    at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:626:16)
    at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
    at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:195:43)
    at q.then.then (/usr/local/lib/node_modules/protractor/built/runner.js:339:29)
    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
[10:17:07] E/launcher - Process exited with error code 199

注意:Web驱动程序正在运行,并且我具有chrome版本67.0.3396.87(正式版本)(64位)

我的操作系统是ubuntu,我该如何解决?谢谢您的时间

1 个答案:

答案 0 :(得分:1)

尝试在配置中添加镶边选项--no-sandbox

capabilities: {
  'browserName': 'chrome',
  'chromeOptions': {
    'args': ['--no-sandbox']
  }
},