Selenium学习之==>WebDriver驱动对照表

本文提供了Chrome、Firefox和IE浏览器的WebDriver驱动版本兼容性指南,包括各浏览器版本对应的WebDriver版本及下载地址,帮助解决版本冲突导致的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自www.imdsx.cn

1、Chrome

  对于chrome浏览器,有时候会有闪退的情况,也许是版本冲突的问题,我们要对照着这个表来对照查看是不是webdriver和chrome版本不对。

chromedriver版本支持的Chrome版本
v2.39v66-68
v2.38v65-67
v2.37v64-66
v2.36v63-65
v2.35v62-64
v2.34v61-63
v2.33v60-62
v2.32v59-61
v2.31v58-60
v2.30v58-60
v2.29v56-58
v2.28v55-57
v2.27v54-56
v2.26v53-55
v2.25v53-55
v2.24v52-54
v2.23v51-53
v2.22v49-52
v2.21v46-50
v2.20v43-48
v2.19v43-47
v2.18v43-46
v2.17v42-43
v2.16v42-45
v2.15v40-43
v2.14v39-42
v2.13v38-41
v2.12v36-40
v2.11v36-40
v2.10v33-36
v2.9v31-34
v2.8v30-33
v2.7v30-33
v2.6v29-32
v2.5v29-32
v2.4v29-32

Chrome的WebDriver驱动下载地址:http://chromedriver.storage.googleapis.com/index.html

2、Firefox

Firefox驱动下载地址为:https://github.com/mozilla/geckodriver/releases/

根据自己的操作系统下载对应的驱动即可,使用的话,需要把驱动的路径和火狐浏览器的路径加入到环境变量里面才可以

由于最新版火狐不再支持FireBug等开发工具,可以通过 https://ftp.mozilla.org/pub/firefox/releases/ 下载49版本以下的火狐就可以增加Firebug等扩展了
3、IE
IE浏览器驱动下载地址为: http://selenium-release.storage.googleapis.com/index.html
根据自己selenium版本下载对应版本的驱动即可,python的话,下载里面的IEDriverServerxxx.zip即可,这个是区分32和64位系统的,根据自己的系统下载即可,需要注意的是,如果要打开IE浏览器的话,需要在浏览器的Internet选项中的安全页里有4个安全选项,Internet、本地Internet、受信任的站点、受限制的站点,这4个里面都有一个启用保护模式,都需要勾选上才可以,还得把驱动的路径加入到环境变量中。

转载于:https://www.cnblogs.com/L-Test/p/9342914.html

Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from selenium import webdriver >>> from selenium.webdriver.chrome.service import Service >>> from webdriver_manager.chrome import ChromeDriverManager >>> >>> # 自动安装驱动并创建浏览器实例 >>> def create_driver(): ... # 自动下载匹配版本的ChromeDriver ... driver_path = ChromeDriverManager().install() ... >>> # 创建服务配置(必须使用Service类) >>> service = Service(executable_path=driver_path) File "<python-input-7>", line 1 service = Service(executable_path=driver_path) IndentationError: unexpected indent >>> >>> # 初始化浏览器选项 >>> options = webdriver.ChromeOptions() File "<python-input-10>", line 1 options = webdriver.ChromeOptions() IndentationError: unexpected indent >>> options.add_argument("--start-maximized") # 窗口最大化 File "<python-input-11>", line 1 options.add_argument("--start-maximized") # 窗口最大化 IndentationError: unexpected indent >>> >>> # 创建浏览器实例 >>> driver = webdriver.Chrome(service=service, options=options) File "<python-input-14>", line 1 driver = webdriver.Chrome(service=service, options=options) IndentationError: unexpected indent >>> return driver File "<python-input-15>", line 1 return driver IndentationError: unexpected indent >>> >>> # 测试用例 >>> def test_baidu_search(): ... driver = create_driver() ... try: ... driver.get("https://www.baidu.com") ... print("当前页面标题:", driver.title) ... assert "百度" in driver.title ... finally: ... driver.quit() ... File "<python-input-18>", line 3 try: IndentationError: unexpected indent >>> if __name__ == "__main__": ... test_baidu_search() ... Traceback (most recent call last): File "<python-input-19>", line 2, in <module> test_baidu_search() ^^^^^^^^^^^^^^^^^ NameError: name 'test_baidu_search' is not defined >>>为什么没有反应
最新发布
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值