0

I downloaded chromedriver on to my raspberry pi (no gui os) from here: https://launchpad.net/ubuntu/trusty/armhf/chromium-chromedriver/65.0.3325.181-0ubuntu0.14.04.1

And I then installed it using dpkg -i and I can verify it installed to '/usr/lib/chromium-browser/chromedriver'.

When I try to run my script that uses selenium:

options = Options()
options.add_argument(f'user-agent={USER_AGENT}')
options.add_argument('--window-size=1024,768')
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('disable-infobars')
options.add_argument("--disable-extensions")
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options=options)
# Fetch video url.
driver.get(url)

It crashes with the following error:

selenium.common.exceptions.WebDriverException: Message: unknown error: 
session deleted because of page crash
from tab crashed

This error occurs on:

driver.get(url)

How would I fix this? Is it how I set up selenium in my code? Or how I installed it?

Edit: Is it possible that the error is caused by the version of chromium-chromedriver installed from launchpad is version 65 and my chromium-broswer install is version 72?

If so how would I install an older version of chromium-browser?

OultimoCoder
  • 244
  • 2
  • 7
  • 24
  • Does [this](https://stackoverflow.com/questions/53902507/unknown-error-session-deleted-because-of-page-crash-from-unknown-error-cannot) helps you? – undetected Selenium May 14 '19 at 19:14

1 Answers1

0

I suspect this has nothing to do with running in headless mode. How did you "verify it installed to '/usr/lib/chromium-browser/chromedriver'"?

You are saying the code:

driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
driver.get(url)

runs without problems? I would have thought it would need a full path of:

driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver/chromedriver.exe')
driver.get(url)

Since the chromedriver.exe is a file and not a folder (although I personally just have chromedriver.exe in the same directory so I omit this argument...perhaps I do not understand it fully). If that works, you should systematically add options 1 by 1 until it breaks so you know exactly what option is breaking it.

Reedinationer
  • 5,661
  • 1
  • 12
  • 33
  • When I change the path to the one you suggested I get this error: NotADirectoryError: [Errno 20] Not a directory: '/usr/lib/chromium-browser/chromedriver/chromedriver.exe' Regarding how I verified it downloaded correctly I just navigated to the folder and checked everything was there. The code does not run without problems upon reaching driver.get(url) it errors. – OultimoCoder May 14 '19 at 17:50
  • Well maybe it has to do with your `url` then. I think the best approach would be to make a [MCVE](https://stackoverflow.com/help/reprex). Otherwise I (or any other poster on here) will not be able to reproduce the error, and all our answers will be speculative at best. – Reedinationer May 14 '19 at 18:24