I've been through most Google results and stack answers about this. My problem is kind of strange, because even if I copy other's working code exactly onto my colab notebook I get the same WebDriverException. WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1.
I've tried many different combinations and since even otherwise functional code isn't working for me, I think I must be doing something wrong trivially. Any help is appreciated, thank you.
I can run it locally on a Jupyter notebook. Given this sample:
!pip install selenium
!pip install webdriver_manager
!apt-get update
!apt-get install -y chromium-browser
!apt-get install chromium-chromedriver
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_experimental_option("detach", True)
options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver_path = "usr/bin/chromedriver"
chrome = webdriver.Chrome(driver_path,options=options)
Error log:
<ipython-input-3-0dcd16366705>:10: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
chrome = webdriver.Chrome(driver_path,options=options)
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/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
If I change it to a service object:
serv = ChromeService('usr/bin/chromedriver', options=options)
chrome = webdriver.Chrome(service = serv, options=options)
Error:
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/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Any help or advice is much appreciated, thank you!