I have an EC2 machine from AWS with ARM flavour. I installed Python 3, and then used pip3
to install Selenium. I then downloaded the Linux version of chrome driver from here, unzipped it and kept the chromedriver
file in Desktop. When I try to run code like this:
driver = webdriver.Chrome('/home/ec2-user/Desktop/chromedriver')
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
service_log_path, service, keep_alive)
File "/home/ec2-user/.local/lib/python3.7/site-packages/selenium/webdriver/chromium/webdriver.py", line 90, in __init__
self.service.start()
File "/home/ec2-user/.local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
creationflags=self.creationflags)
File "/usr/lib64/python3.7/subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/ec2-user/Desktop/chromedriver'
Any idea how to fix this? May be a different combination of Linux flavour and chrome driver from somewhere else?
CodePudding user response:
This error message...
OSError: [Errno 8] Exec format error: '/home/ec2-user/Desktop/chromedriver'
...implies that you are using an incorrect format of ChromeDriver executable.
Deep Dive
As you are using AWS EC2 ARM flavour you need to use the either ARM64 or ARM7 variant of ChromeDriver.
Additionally, you seem to have downloaded ChromeDriver v100.x where as the latest version of google-chrome is Chrome Version 99.0.4844.84
and you need the matching version of ChromeDriver as per the installed version of Google Chrome within the system.
Solution
As @Mark B
pointed out in his comment you need to download the matching version of ChromeDriver as per the discussion Compile ChromeDriver on ARM