小编典典

远程Webdriver上的Chrome(通过Grid)无法启动

selenium

我在使用Grid上的远程WebDriver功能(使用Firefox和Chrome使用1个Linux集线器和1个Linux节点)使用Chrome启动Cucumber测试时遇到问题。Firefox测试非常顺利,但Chrome返回以下错误:

unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:    java.lang.reflect.InvocationTargetException

Command duration or timeout: 20.67 seconds
Build info: version: '2.30.0', revision: 'dc1ef9c', time: '2013-02-19 00:15:27'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',      java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver (org.openqa.selenium.WebDriverException) (Selenium::WebDriver::Error::UnknownError)

浏览器初始化为:

$profile = Selenium::WebDriver::Chrome::Profile.new
$profile['download.prompt_for_download'] = false
$profile['download.default_directory'] = downloads_path

capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    platform: "Linux",
    version: "",
    "chrome.profile" => $profile)

browser = Watir::Browser.new(
    :remote,
    :url => 'http://aut.theurl.net:4444/wd/hub',
    :desired_capabilities => capabilities)

更多信息:

  • 我尝试了chromedriver 2.3和2.2版本以及selenium-server-standalone 2.35和2.3版本失败。
  • 通过终端,chromedriver成功启动,因此路径似乎没问题。

Chrome似乎在远程节点上启动,但立即失败。我有点主意,所以欢迎任何想法或指导。

提前致谢!

==================================

更新:添加了更多控制台日志信息。也许这里有更多信息,但是我看不到任何有价值的信息。

11:45:47.612 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:       java.lang.reflect.InvocationTargetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',   java.version: '1.7.0_25'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
(...)
Caused by: org.openqa.selenium.WebDriverException:    java.lang.reflect.InvocationTargetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',   java.version: '1.7.0_25'
Driver info: driver.version: unknown
at   org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:72)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:56)
    (...)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at      sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:62)
    ... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start:     exited abnormally
  (Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',  java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at     sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    (...)
11:45:47.612 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The   server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',   java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver

阅读 551

收藏
2020-06-26

共1个答案

小编典典

最后,它起作用了!

我改变了两件事:

  • 使用其他chromedriver(linux64而非linux32)
  • 使用Dwebdriver.chrome.driverswitch 在命令中包含chromedriver路径:
    java -jar ./selenium-server-standalone-2.35.0.jar - Dwebdriver.chrome.driver='/opt/drivers/chromedriver' -role webdriver -hub  http://192.168.1.10:4444/grid/register -port 5566 -browser browserName=chrome,maxInstances=5,platform=LINUX &
    

非常感谢您的参考:)

2020-06-26