Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDrivers::Chromedriver fails to drive Chrome under WSL #145

Closed
derrelldurrett opened this issue Jul 16, 2019 · 2 comments
Closed

WebDrivers::Chromedriver fails to drive Chrome under WSL #145

derrelldurrett opened this issue Jul 16, 2019 · 2 comments

Comments

@derrelldurrett
Copy link

I'm attempting to use Chromedriver under WSL (Windows Subsystem for Linux -- I'm using Ubuntu 18.04) to run headless tests under Rails/Cucumber/Capybara/Selenium.

  • Webdrivers::Chromedriver.required_version = '75.0.3770.140'
  • Ruby/Rails version: 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]/5.2.3
  • Operating system / CI Environment: Microsoft Windows [Version 10.0.18362.239] with WSL running Ubuntu 18.04 [Linux version 4.4.0-18362-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) implement geckodriver support #1-Microsoft Mon Mar 18 12:02:00 PST 2019]
  • Browser and version: Google Chrome 75.0.3770.100

my features/support/env.rb:

require "selenium/webdriver"
require 'webdrivers/chromedriver'

Capybara.javascript_driver = :headless_chrome
Webdrivers.logger.level = :DEBUG
Webdrivers::Chromedriver.required_version = '75.0.3770.140'
Selenium::WebDriver::Chrome.path = '/usr/bin/google-chrome'

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
      chromeOptions: { args: %w(headless single-process no-gpu no-sandbox disable-setuid-sandbox) } # disable-gpu proxy-server="direct://" disable-dev-shm-usage proxy-bypass-list="*"
  )

  Capybara::Selenium::Driver.new app,
                                 browser: :chrome,
                                 desired_capabilities: capabilities
end

Expected Behavior

I expected it to run my tests (headless).

Actual Behavior

      unknown error: Chrome failed to start: crashed
        (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.) (Selenium::WebDriver::Error::UnknownError)
      #0 0x7f8211ae07a9 <unknown>

I don't know if this is simply a problem with running on WSL or a problem that's manageable with webdrivers. I'm posting it here (and StackOverflow, and the WSL GitHub page -- in response to this issue) in the hopes it'll have a solution.

@twalpole
Copy link
Collaborator

Chrome is failing to start/crashing which means it's not an issue with webdrivers. Most likely the cause is not having the correct combination of needed command line options for the container you're trying to run in.

@twalpole
Copy link
Collaborator

@derrelldurrett Note: your issue may be the use of passing chromeOptions - Chrome 75 changed it's setting to goog:chromeOptions' - If you used Selenium::WebDriver::Chrome::Options` instead it would have handled the conversion for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants