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



我在Linux Ubuntu上运行量角器测试时遇到问题,浏览器无法打开(谷歌浏览器(来运行测试我使用命令
量角器 ./配置.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

我使用网络驱动程序管理器:康索尔日志

[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

命令 Web 驱动程序管理器状态

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)

谷歌浏览器版本:版本 65.0.3325.181(64 位(

换了电脑,以前没有问题(在我使用 Linux Mint 之前,现在我有 Linux Ubuntu(。

它是在码头工人上启动的角度应用程序

我的配置.js看起来

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

在控制台 Web 驱动程序管理器中任何错误

知道我能做什么吗?

我解决了问题当我使用命令启动网络驱动程序管理器时

webdriver-manager start --detach 

我没有任何错误

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

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

相关内容

  • 没有找到相关文章

最新更新