1

I've got problems when using Chrome Webdriver in Raspberry Pi. I downloaded and installed builds of chromium browser, driver and codecs from here. (Built files located at the bottom of the page)

I checked that the packages were successfully installed on the device:

$ dpkg -l | grep chromium
ii  chromium-browser                      65.0.3325.181-0ubuntu0.14.04.1        armhf        Chromium web browser, open-source version of Chrome
ii  chromium-chromedriver                 65.0.3325.181-0ubuntu0.14.04.1        armhf        WebDriver driver for the Chromium Browser
ii  chromium-codecs-ffmpeg-extra          65.0.3325.181-0ubuntu0.14.04.1        armhf        Extra ffmpeg codecs for the Chromium Browser
rc  rpi-chromium-mods                     20190613                              armhf        Raspberry Pi-specific mods to Chromium

...and also checked that the files were installed at `/usr/lib/chromium-browser'

$ ls -al /usr/lib/chromium-browser/ | grep chrom
-rw-r--r--  1 root root   813215 Mar 22  2018 chrome_100_percent.pak
-rw-r--r--  1 root root  1083947 Mar 22  2018 chrome_200_percent.pak
-rwxr-xr-x  1 root root  6334180 Mar 23  2018 chromedriver
-r-sr-xr-x  1 root root    13728 Mar 23  2018 chrome-sandbox
-rwxr-xr-x  1 root root 91760672 Mar 23  2018 chromium-browser

Then I created selenium-test.py, the script I tried to execute chromedriver.

# selenium-test.py
from selenium import webdriver
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')

But when I ran the script, the script just raised "unknown error".

$ python3 selenium-test.py
Traceback (most recent call last):
  File "selenium-test.py", line 2, in <module>
    driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
  File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/pi/.local/lib/python3.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
  (Driver info: chromedriver=2.35 (0),platform=Linux 4.19.50-v7+ armv7l)

What is the problem on this process? I have installed correct builds, version do match, and used right script.

1 Answer 1

3

Well I've just solved this problem so quickly... and answering myself in case someone faces the same problem.

Adding options when initializing the driver does the work:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')

driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', chrome_options=options)

print('Success')
Sign up to request clarification or add additional context in comments.

2 Comments

Count yourself lucky :) I am sure you're still clueless how and why it worked
@DebanjanB Thanks : ) I assume that the reason is because pi cannot display extra chromium browser windows, so I should give options such as headless whether I need it or not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.