python-selenium ”selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find
3、找到Google Chrome安装目录,一般在C:\Users\Administrator\AppData\Local\Google\Chrome\Application\Google Chrome.exe,将Google Chrome.exe复制一个出来,并重命名为chrome.exe,并将目录C:\Users\Administrator\AppData\Local\Google\Chrom
解决方法如下:
1、确认当前的Google Chrome版本号与chromedriver版本号一致,如果不一致,到http://chromedriver.storage.googleapis.com/index.html下载与当前chrome浏览 器对应的驱动。
http://selenium-release.storage.googleapis.com/index.html selenium下载地址;
2、将chromedriver.exe文件放入python的scripts目录,并将该scripts目录添加到系统path变量中;
3、找到Google Chrome安装目录,一般在C:\Users\Administrator\AppData\Local\Google\Chrome\Application\Google Chrome.exe,将Google Chrome.exe复制一个出来,并重命名为chrome.exe,并将目录C:\Users\Administrator\AppData\Local\Google\Chrome\Application\添加到系统path变量中
以上三步,基本能解决问题,网上一些帖子说在py脚本文件中加入options.binary_location=r'C:\\Users\\Administrator\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe' 指定绝对路径,这样挺麻烦的,治标不治本,后期你每个py脚本都要指定路径。
注:selenium调用chrome时,是调用chrome.exe,而不是默认的Google Chrome.exe

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)