chromedriver下载与安装方法,亲测可用 | 您所在的位置:网站首页 › 在哪能下载谷歌 › chromedriver下载与安装方法,亲测可用 |
chromedriver下载地址: http://chromedriver.storage.googleapis.com/index.html http://npm.taobao.org/mirrors/chromedriver/ 两个地址都可以下载,根据自己的chrome浏览器的版本选择下载即可 查看浏览器版本 ↓,我的版本为88.0.4324.104,目前最新版 把exe文件复制到python的安装目录下: 配置环境变量:此电脑→右击属性→高级系统设置→环境变量→用户变量→Path→编辑→新建,将以下路径复制,然后不要忘记后续全部点击确定 C:\Program Files (x86)\Google\Chrome\Application\打开pycharm,输入以下代码,测试一下是否驱动成功 from selenium import webdriver driver = webdriver.Chrome() url = 'https://www.csdn.net/' driver.get(url) driver.maximize_window()成功!! 注意:浏览器版本自动更新后,可能驱动与之不匹配会报错,如下所示: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 99 Current browser version is 102.0.5005.63 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe此时我们需要重新下载与浏览器对应的驱动,覆盖如下两个位置 1、浏览器安装目录:C:\Program Files\Google\Chrome\Application 2、python安装目录 |
CopyRight 2018-2019 实验室设备网 版权所有 |