您现在的位置是:主页 > news > 宁波专业网站制作/建网站赚钱

宁波专业网站制作/建网站赚钱

admin2025/6/22 1:55:09news

简介宁波专业网站制作,建网站赚钱,怎样给网站做外链,通辽做网站建设重装系统后:selenium无法找到chrome--selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary一、报错二、解决方法三、第二个报错:四、解决方法:一、报错 selenium.common.exceptions.WebDriv…

宁波专业网站制作,建网站赚钱,怎样给网站做外链,通辽做网站建设重装系统后:selenium无法找到chrome--selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary一、报错二、解决方法三、第二个报错:四、解决方法:一、报错 selenium.common.exceptions.WebDriv…

重装系统后:selenium无法找到chrome--selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

  • 一、报错
  • 二、解决方法
  • 三、第二个报错:
  • 四、解决方法:

一、报错

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

在这里插入图片描述

翻译过来为:selenium.common.exceptions.WebDriverException:消息:未知错误:找不到Chrome二进制文件

即找不到chrome浏览器

二、解决方法

添加chrome路径:

ops.binary_location = r'I:\Program Files (x86)\Google\Chrome\Application\chrome.exe'

ops是传递给option的对象
完整为:

from selenium.webdriver.chrome.options import Options
ops.binary_location = r'I:\Program Files (x86)\Google\Chrome\Application\chrome.exe'(此处是我的chrome位置,需要在r""中填上自己的chrome位置)
browser = webdriver.Chrome(options=ops)

在这里插入图片描述
这个是我自己设置的输出,出现代表着正确

三、第二个报错:

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chrome

连接错误,需要

ping localhost

如果为ping的结果为:
一般错误
一般错误
一般错误
这样的结果
则存在错误

四、解决方法:

关闭防火墙
在这里插入图片描述
在这里插入图片描述
再次,

ping localhost

在这里插入图片描述
参见《mac selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedri》链接: link.