报错内容:selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 99
这个报错显示镜像版本于谷歌版本不匹配
谷歌镜像版本下载链接:https://registry.npmmirror.com/binary.html?path=chromedriver/
注:所下载的镜像版本必须低于自己的谷歌版本
将下载好的镜像版本进行解压并且拷贝到python的安装路径下
方法一--找到Lib目录
--找到lib目录下的site-packages
--将解压好的exe程序添加到site-packages目录下
方法二:
找到python路径下的scripts下将安装好的exe安装到这个目录下
--添加到系统环境变量里的path路径下(两种方法添加环境变量一样)
验证是否成功代码
from selenium import webdriver
a=webdriver.Chrome()
a.get('https://www.baidu.com/')