安装 selenium 及配置 edge 浏览器驱动

01 安装selenium 1.1 安装selenium类库 pip install selenium1.1 安装浏览器驱动 安装浏览器驱动时注意版本保持一致。 查看浏览器版本:在这个网站上下载驱动&

01 安装selenium

1.1 安装selenium类库

pip install selenium

1.1 安装浏览器驱动

安装浏览器驱动时注意版本保持一致。
查看浏览器版本:

在这个网站上下载驱动:https://developer.microsoft/zh-cn/microsoft-edge/tools/webdriver/。
上图中看到我的Edge版本是 120.0.2210.61。进入网站下载驱动。

将其解压到python解释器目录并重命名为MicrosoftWebDriver.exe

1.3 测试是否安装成功

将压缩包解压到一个指定路径下。比如 D:/util 路径。访问百度,看看能否正常打开。

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.edge.service import Service


browser = webdriver.Edge()
browser.get("http://www.baidu")
time.sleep(10)

成功运行~

发布者:admin,转转请注明出处:http://www.yc00.com/web/1737986267a4006721.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信