So I'm trying to run Selenium on my raspberry pi using Chromium and for some reason I can't get my python file to compile. I keep getting the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver.exe'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 75, in start
os.path.basename(self.path), docs_msg)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Here is the python code I'm trying to run:
from selenium import webdriver
import os
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
driver.get("http://www.google.com")
driver.quit()
Any ideas?
Update
After removing the '.exe' at the end of chromedriver, it now produces the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 68, in start
self.service_args, env=env, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
Visit the link: https://chromedriver.chromium.org/downloads. There shall be links available for download for various chromedriver versions. Select the version which is compatible with the Chrome available to our system.
ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors.
Selenium test scripts can be written in different programming languages like Java, Python, C# and many more. These test scripts can run across various browsers like Chrome, Safari, Firefox, Opera and also provides support across various platforms like Windows, Mac OS, Linux, Solaris.
Ubuntu has builds of chromium-chromedriver as .deb files for armhf.
On launchpad, therefore, you can find chromium-chromedriver armhf builds available for download. Just download the latest version, and since they have no dependencies, you can install by running dpkg -i chromium-chromedriver_58.0.3029.96-0ubuntu0.14.04.1174_armhf.deb
. Then chromedriver will be available in /usr/lib/chromium-browser/chromedriver
.
At the moment Chrome Driver dont support ARM processors architecture anymore.
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=95322
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With