MacBook M2上Chromedriver与Chrome崩溃问题求助
MacBook M2上ChromeDriver与Chrome崩溃问题
在MacBook M2(macOS Ventura 13.2.1)设备上使用ChromeDriver运行测试时,出现Chrome与ChromeDriver崩溃问题:浏览器窗口打开数秒后崩溃,执行get()、点击等操作时均会触发崩溃,报错信息如下:
Stacktrace: pages/base_page.py:90: in view self.driver.get(self.rel_url) E selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status E from disconnected: Unable to receive message from renderer E (Session info: chrome=111.0.5563.64) /opt/homebrew/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException INTERNALERROR> selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools INTERNALERROR> (failed to check if window was closed: disconnected: not connected to DevTools) INTERNALERROR> (Session info: chrome=111.0.5563.64)
环境信息
- Python 3.11(通过Brew安装)
- macOS Ventura 13.2.1(M2芯片)
- Chrome版本:111.0.5563.64
- ChromeDriver版本:111.0.5563.64(安装于/usr/local/bin/chromedriver)
已尝试的解决方案
- 升级至最新版本Chrome和ChromeDriver
- 重装Chrome与ChromeDriver
- 指定Brew安装的ChromeDriver路径
- 无头模式下运行测试正常
当前使用的Chrome选项
chrome_options.add_argument('--disable-notifications') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--ignore-certificate-errors') chrome_options.add_argument('--hide-scrollbars')
WebDriver初始化代码
webdriver.Chrome(desired_capabilities=capabilities)
内容的提问来源于stack exchange,提问作者Daniel Proskurin
相关产品推荐
相关产品推荐

