最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

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

业界 admin 34浏览 0评论

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)

成功运行~

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)

成功运行~

发布评论

评论列表 (0)

  1. 暂无评论