Selenium无法开始测试WebDriverError:未知错误:Chrome无法启动:异常退出

时间:2018-04-08 20:22:42

标签: selenium selenium-webdriver protractor selenium-chromedriver webdriver-manager

我在linux ubuntu上运行量角器测试有问题,浏览器没有打开(谷歌浏览器)运行测试我使用命令
量角器./config.js

我收到了错误

[22:04:01] I/launcher - Running 1 instances of WebDriver
[22:04:01] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[22:05:01] E/launcher - unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.13.0-38-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.06 seconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: 'maciek', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-38-generic', java.version: '1.8.0_161'
Driver info: driver.version: unknown
[22:05:01] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.13.0-38-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.06 seconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: 'maciek', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-38-generic', java.version: '1.8.0_161'
Driver info: driver.version: unknown
    at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
    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 process._tickCallback (internal/process/next_tick.js:109: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)
[22:05:01] E/launcher - Process exited with error code 199

我使用webdriver-manager: consol log

[18:58:53] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.1 -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.11.0.jar -port 4444
[18:58:53] I/start - seleniumProcess.pid: 17729
18:58:54.153 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.11.0', revision: 'e59cfb3'
18:58:54.154 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-04-09 18:58:54.223:INFO::main: Logging initialized @250ms to org.seleniumhq.jetty9.util.log.StdErrLog
18:58:54.339 INFO [SeleniumServer.boot] - Welcome to Selenium for Workgroups....
18:58:54.340 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
18:58:59.229 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: chrome, chromeOptions: {}, count: 1}
18:58:59.230 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 16779
Only local connections are allowed

命令webdriver-manager status

webdriver-manager: using global installed version 12.0.6
[22:08:53] I/status - selenium standalone version available: 3.11.0 [last]
[22:08:53] I/status - chromedriver versions available: 2.36, 2.37 [last]
[22:08:53] I/status - geckodriver version available: v0.20.1 [last]
[22:08:53] I/status - android-sdk is not present
[22:08:53] I/status - appium is not present

和java --version

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

google chrome版本: 版本65.0.3325.181(64位)

我改变了计算机,之前我没有遇到过问题(在我使用linux mint之前,我有linux ubuntu)。

这是在docker上开始的角度应用

我的config.js看起来那个

exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['e2e/myTest'],
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
     args: ['--no-sandbox']
   }
  },
  chromeOnly: true,
};

在console webdriver-manager中出现任何错误

知道我能做什么吗?

2 个答案:

答案 0 :(得分:1)

我解决了问题 当我使用命令

启动webdriver-manager时
webdriver-manager start --detach 

我没有任何错误

答案 1 :(得分:0)

您有两个安装了不同版本的chrome驱动程序。也许你可以尝试卸载旧的。 此外,您无需提供chromeOnly标志。

确保没有符号链接指向不同的文件夹。