Chromedriver in an amazonlinux2 aarch64 docker container on a Mac M1

255 views
Skip to first unread message

Niklas Möller

unread,
Mar 15, 2022, 8:46:50 AM3/15/22
to ChromeDriver Users
Hi everyone,

I recently migrated to a Mac M1. When I build the docker file with native architecture (aarch64), I'm not able to install chrome or chromium and chromedriver. It's not contained in the package manager and I can't find a manual how to do it.

I tried to build the docker container with the platform set to "intel/amd64" which works, but when I run chromedriver, it always crashes. Below you'll find the script I used and the message I get.

A colleague of mine who is running the same docker file with the same chrome version but build natively on an Intel Mac, does not have any problems.

Is there a way to either get chrome or chromium with chromedriver running in the docker container on the native architecture of my M1 or can somebody tell me what I have to do to fix the problem with chrome crashing in the intel/amd64 build docker file on my M1?

Chrome & Chromedriver versions:
```
Google Chrome 99.0.4844.51
ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875})
```

The code I'm using to test chromedriver:
```py
import time
from selenium import webdriver
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
driver.get('http://www.google.com/')
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
```

The error stacktrace I get, when I run the script on an M1 mac in an intel/amd64 compiled docker container:
```
Traceback (most recent call last):
  File "chromedrivertest.py", line 5, in <module>
    driver = webdriver.Chrome('/usr/local/bin/chromedriver')  # Optional argument, if not specified will search path.
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (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.)
```

Hope someone can help me. I would actually prefer to be able to run chromedriver with the native architecture (as everything is a lot faster) but I'm also fine with fixing the error in the intel/amd64 version.

Regards,
Niklas
Reply all
Reply to author
Forward
0 new messages