selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Users\XXX\AppData\Local\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(options=chrome_options)
# 启动浏览器
url = "https://baidu.com"
driver.get(url)
print(driver.title)
# 关闭浏览器
driver.quit()
if __name__ == "__main__":
run_code = 0
添加上述参数,即可正常使用selenium打开浏览器。