生信喵 发表于 2024-10-9 21:38:37

chromedriver安装

# 背景

使用selenium自动化开发,提示确实chrome的驱动

# 原因

chromedriver的版本一定要与Chrome的版本一致,不然就不起作用。

# 下载chromedrive

有两个下载地址如下:

```
1、http://chromedriver.storage.googleapis.com/index.html

2、https://npm.taobao.org/mirrors/chromedriver/
```

先查看你的Chrome版本,在浏览器中输入chrome://version/

我的是

129.0.6668.90 (正式版本) (64 位) (cohort: Control)

前面两个位置没找到我的对应版本,下面的网址可以说是全面了

`https://chromefortesting.automationhub.in/`

选择对应的版本129
!(https://roim-picx-bpc.pages.dev/rest/gDqfq8K.png)
下载后

# 安装chromedrive

解压压缩包,找到chromedriver.exe复制到chrome的安装目录(其实也可以随便放一个文件夹)。复制chromedriver.exe文件的路径并加入到电脑的环境变量中去。具体的:
!(https://roim-picx-bpc.pages.dev/rest/CSfGq8K.png)
进入环境变量编辑界面,添加到用户变量即可,双击PATH,将你的文件位置(C:\Program Files\Google\Chrome\Application)添加到后面。
!(https://roim-picx-bpc.pages.dev/rest/3x3Iq8K.png)
完成后在cmd下输入chromedriver验证是否安装成功:
!(https://roim-picx-bpc.pages.dev/rest/7FGIq8K.png)
出现上述提示则安装ok了。

回到python代码中运行,没有报错了。
页: [1]
查看完整版本: chromedriver安装