代码之家  ›  专栏  ›  技术社区  ›  Matrix

进程意外关闭,状态为1,watir(ruby on rails)中的firefox webdrivers

  •  0
  • Matrix  · 技术社区  · 6 年前

    我有rails应用程序

    gem 'headless'
    gem 'watir'
    gem 'webdrivers'
    gem 'watir-screenshot-stitch'
    gem 'watir-scroll'
    

    sudo apt-get install firefox-esr

    firefox-esr -v
    Mozilla Firefox 52.9.0
    

    我在这里下载最新版本的壁虎 https://github.com/mozilla/geckodriver/releases v0.21.0,我把驱动程序 ~/.webdrivers/

    browser = Watir::Browser.new :firefox, headless:true

    我有一个即时错误:

    Process unexpectedly closed with status 1
    
    response.rb line 69 in assert_ok
    response.rb line 32 in initialize
    common.rb line 84 in new
    common.rb line 84 in create_response
    default.rb line 104 in request
    common.rb line 62 in call
    bridge.rb line 164 in execute
    bridge.rb line 97 in create_session
    driver.rb line 50 in initialize
    driver.rb line 31 in new
    driver.rb line 31 in new
    driver.rb line 52 in for
    webdriver.rb line 86 in for
    

    我试着用v0.19.1来对付geckodrivers

    但什么都不起作用,我不知道如何有更多的日志来调试。。。

    编辑:使用 Selenium::WebDriver.logger.level = :debug

    DEBUG Selenium polling for socket on ["127.0.0.1", 4445]
    App 1591 output: 1535219812449  geckodriver INFO    geckodriver 0.21.0
    App 1591 output: 1535219812461  geckodriver INFO    Listening on 127.0.0.1:4445 
    App 1591 output: 2018-08-25 19:56:52 INFO Selenium Skipping handshake as we know it is W3C. 
    App 1591 output: 2018-08-25 19:56:52 INFO Selenium
        -> POST session 
    App 1591 output: 2018-08-25 19:56:52 INFO Selenium    >>> http://127.0.0.1:4445/session | {"desiredCapabilities":{"browserName":"firefox","version":"","platform":"ANY","javascriptEnabled":true,"cssSelectorsEnabled":true,"takesScreenshot":true,"nativeEvents":false,"rotatable":false,"moz:firefoxOptions":{"args":["--headless"]}},"capabilities":{"firstMatch":[{"browserName":"firefox","moz:firefoxOptions":{"args":["--headless"]}}]}} App 1591 output: 2018-08-25 19:56:52 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/3.14.0 (ruby linux)", "Content-Length"=>"341"} App 1591 output: 1535219812709  mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.ILvfKH3MZPFj" App 1591 output: Error: GDK_BACKEND does not match available displays App 1591 output: 2018-08-25 19:56:52 INFO Selenium <- {"value":{"error":"unknown error","message":"Process unexpectedly closed with status 1","stacktrace":""}}
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   titusfortner    6 年前

    我认为我们还没有为Firefox实现headless。如果您在机器上安装了xvfb,您可以使用headless gem。