Selenium报错:chromedriver意外退出(状态码-5)求排查方案
Selenium爬取报错排查求助:chromedriver意外退出(状态码-5)
错误详情
selenium.common.exceptions.WebDriverException: Message: Service /home/****/public_html/.../Dependencies/chromedriver-linux64/chromedriver unexpectedly exited. Status code was: -5
环境信息
- Selenium版本:3.141.0
- ChromeDriver版本:117.0.5938.92
- Chrome浏览器版本:117.0.5938.92
已尝试但无效的方案
- 确认ChromeDriver为对应版本的最新版
- 验证ChromeDriver与Chrome浏览器版本完全匹配
- 尝试过Stack Overflow相关问题的常规解决方案,但未解决问题
驱动初始化代码
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import (TimeoutException, NoSuchElementException) def driver_setup(website): """Set up the web driver with Chrome options.""" options = webdriver.ChromeOptions() options.add_argument("--no-sandbox") options.add_argument("--disable-notifications") options.add_argument('--headless') options.add_argument("--disable-gpu") options.add_argument("--window-size=1440,1080") options.add_argument('--disable-dev-shm-usage') options.binary_location = "/home/**/public_html/chrome-linux64/chrome" install_path = "/home/***/public_html/chromedriver-linux64/chromedriver" driver = webdriver.Chrome(executable_path=install_path, options=options) print("Website loading..") driver.get(website) return driver
恳请各位帮忙排查错误原因并提供可行的解决方案!
内容的提问来源于stack exchange,提问作者Ilias Chemlal
相关产品推荐
相关产品推荐

