Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
Try to download HERE and use this latest chrome driver version:
- https://sites.google.com/chromium.org/driver/
Try this:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
d = webdriver.Chrome('/home/<user>/chromedriver',chrome_options=chrome_options)
d.get('https://www.google.nl/')
Python Selenium ChromeDriver Throws Chrome failed to start Error
I just got the solution. Many solutions suggest the value of options.binary_location
should be ChromeDriver Path, but it must be Chrome Browser Binary Path. So this just successed:
options = Options()
options.binary_location = chrome_path
options.add_argument("--start-maximized")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(options=options, executable_path=driver_path)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist with chromium browser and Selenium Python
I solved the problem by reinstalling chromium through apt sudo apt install chromium-browser
(before that it was installed through snap). My working code looks like this
options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
if headless:
options.add_argument('--headless')
options.binary_location = "/usr/bin/chromium-browser"
self.driver = webdriver.Chrome(options=options)
Related Topics
Simulate Mouse Clicks on Python
Pip Is Not Working for Python 3.10 on Ubuntu
How to Create a User in Linux Using Python
Multiple Instances of Python Running Simultaneously Limited to 35
What Is the Easiest Way to Detect Key Presses in Python 3 on a Linux MAChine
Python Convert Microsoft Office Docs to Plain Text on Linux
Allowing Ctrl-C to Interrupt a Python C-Extension
Python: Interplay Between Lib/Site-Packages/Site.Py and Lib/Site.Py
Linux:Python:Clear Input Buffer Before Raw_Input()
Python's Equivalent for R's Dput() Function
Auto.Arima() Equivalent for Python
Converting Python Objects for Rpy2
Which Command to Use for Checking Whether Python Is 64Bit or 32Bit
Installing Python 2.7 Without Root
Error with Igraph Library - Deprecated Library
How to Control the Keyboard and Mouse with Python
Why Does Python "Preemptively" Hang When Trying to Calculate a Very Large Number