chromedriver版本不匹配
- 报错:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
selenium.common.exceptions.WebDriverException: Message: session not created:
- 原因:
Chrome版本和ChromeDriver版本不一致,极有可能是Chrome浏览器自动升级了新版本,导致两者版本差异,运行不了。 - 解决方案:
-
查看Chrome浏览器的版本
-
在浏览器上方地址栏输入:
chrome://version/ -
显示如下:

-
下载对应版本的驱动
chromedriver下载地址:
http://chromedriver.storage.googleapis.com/index.html -
下拉网页找到对应版本,下载后解压

-
-
将解压后的
chromedriver.exe放在对应位置如下:- 谷歌路径:
C:\Program Files (x86)\Google\Chrome\Application或者C:\Program Files\Google\Chrome\Application
*

python运行目录
-
一种直接的方法是在命令行输入:
where chromedriver(命令行打开方式:windows+R,打开后键入cmd,回车) -

-
根据目录将
chromedriver.exe复制进去
*
-
为了保险最好打开应用程序的包目录:例如
E:\workplace\pycharm_workplace\conda\venv\Lib\site-packages\selenium\webdriver\chrome复制该exe文件进去(非必要) -
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JXVfCDzH-1643001628555)(C:\Users\HP\AppData\Roaming\Typora\typora-user-images\image-20220124131943636.png)]](https://img-blog.csdnimg.cn/997b1157a58f44dcaf287f21dbb59832.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA6aOO6LW36aOO6YeM,size_20,color_FFFFFF,t_70,g_se,x_16)
- 谷歌路径: