0


python selenium对应的浏览器chromedriver版本不一致

目录 

python selenium对应的浏览器chromedriver版本不一致

报错:session not created: This version of ChromeDriver only supports Chrome version

google浏览器对应解决方法

这是因为python使用selenium调用模块的时候,会用chromedriver去调用google浏览器。chrome和chromedriver版本不一致导致的,我们只需要升级下chromedriver的版本即可

浏览器版本查看

//打开google浏览器直接访问,查看浏览器版本
chrome://version/

image

查看chromedriver的版本

进入终端,执行

//我这里已经升级过了,一般比你的浏览器版本老
chromedriver

image

chromedriver下载

上面我们可以看到浏览器和chromedriver版本相差可能过大,我们需要下载一个相近或者相同版本的chromedriver
下载地址: http://chromedriver.storage.googleapis.com/index.html

解压并拷贝

我们下载好后,系统还是会默认使用原先的chromedriver,我们需要拷贝解压后的chromedrvier.exe到用户的google目录和python的安装目录下

//用户的google目录
C:\Program Files (x86)\Google\Chrome\Application

image

//python安装目录,之前我安装到D盘的python目录下了,这里各位同学的情况可能不一样,根据自己情况来哈
D:\python

image

环境变量修改

image

我的是在D盘下了,所以系统变量也是这个,修改后再在终端执行chromedriver,看看版本是否升级成最新,如果没有重启就电脑试试image

标签: python selenium chrome

本文转载自: https://blog.csdn.net/liwench/article/details/129850162
版权归原作者 liwenchao1995 所有, 如有侵权,请联系我们删除。

“python selenium对应的浏览器chromedriver版本不一致”的评论:

还没有评论