Selenium::WebDriver::Error Chrome Crashed on M1 chip
Asked Answered
A

2

10

I've spent several days trying to solve this issue I'm encountering with the following code:

caps = Selenium::WebDriver::Remote::Capabilities.chrome(
      "chromeOptions" => {
        :args => ['--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36 LegalMonsterNoBlock"']
      }
    )
    driver = Selenium::WebDriver.for :remote, url: selenium_host, :desired_capabilities => caps
    driver.get(url)

I'm trying to run a test that calls this method. The test runs fine. It opens up Chrome runs the test, but whenever I reach the part of my application that calls the above method, the test fails with the following error:

Minitest::UnexpectedError: Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: crashed
          (chrome not reachable)
          (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
        Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
        System info: host: '7a6aaccda364', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.121-linuxkit', java.version: '1.8.0_232'
        Driver info: driver.version: unknown
        remote stacktrace: #0 0x0040004b6479 <unknown>

My setup:

  • Macbook with Apple M1, running Big Sur 11.2.2
  • ruby version 2.7.2
  • ChromeDriver 89.0.4389.23 (for m1 chip)
  • Chrome version 89.0.4389.72 (Official Build) (arm64)
  • gem selenium-webdriver version 3.142.3
  • Running a docker selenium/standalone-chrome-debug:3.141.59-zinc

I have tried several things already:

  • Adding --headless, --no-sandbox options to args: args => ['--headless', '--no-sandbox' ...
  • Installing chromedriver and chrome via brew instead of downloading binary
  • Reinstalling chrome and chromedriver
  • Explicitly speficying path to both chrome and chromedriver (Selenium::WebDriver::Chrome.path = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' and Selenium::WebDriver::Chrome.driver_path="/path/to/chrome_driver_binary/chromedriver")

Any other experiencing such issues?

Amiss answered 4/3, 2021 at 16:5 Comment(2)
I have a similar issue too. Have you got your solution?Phototopography
I too am facing this issueMonocotyledon
A
4

It turned out that it is my docker image, that does not support the arm64-architecture, so it was this step: Running a docker selenium/standalone-chrome-debug:3.141.59-zinc.

There was no issue if I disabled the part of the tests that used the docker container. I imagine this is no possible for everyone, but lets hope that there'll be a selenium image that will support arm64 architecture soon.

See Selenium issue here.

Amiss answered 17/6, 2021 at 9:6 Comment(0)
M
3

For me using a docker image compatible with the arm64 architecture solved the issue. It was easy to set it up after understanding the problem using an image from https://hub.docker.com/u/seleniarm

I just run the command

docker run -d -p 4444:4444 seleniarm/standalone-chromium

This set it up where I needed and worked just fine.

I had the same error when I was trying to run in a docker using the below command.

docker run -d -p 4444:4444 selenium/standalone-chrome

My solution was mentioned in the github answer for the issue posted above and the link to the answer so we can give the proper credits is this:

https://github.com/SeleniumHQ/docker-selenium/issues/1076#issuecomment-788343926

Hope this sheds some light for others.

Mechellemechlin answered 10/10, 2022 at 17:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.