Selenium 管理器无法在我公司的 VPN 中安装驱动程序

问题描述 投票:0回答:1

Selenium 管理器无法安装 Webdriver 并抛出错误:

raise NoSuchDriverException(msg) from err
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for MicrosoftEdge using Selenium Manager.

任何帮助将不胜感激,我被这个问题困扰了很长时间。 没有VPN,它能够加载浏览器并成功执行任务。

硒版本:4.16 Python版本:3.10.4 边缘版本:124.0.2478.67

我的代码:

from selenium import webdriver

# Initialize the Edge WebDriver with the options
driver = webdriver.Edge()

# Navigate to a website
driver.get("https://www.google.com")

# Print the title of the page
print("Title of the page:", driver.title)

# Close the browser
driver.quit()
python selenium-webdriver
1个回答
0
投票

在您的情况下,您需要要求 IT 团队将用于解析网络驱动程序的 URL 列入白名单,或者您需要他们共享代理的详细信息,这将允许您的请求访问 URL下载驱动程序。

您可以参考这里写的答案 -> Webdrivermanager 无法下载驱动程序,因为在公司 VPN 上工作时代理不适用

对于 Python,您需要一个自定义 http 客户端来充当您的请求的代理。 pyDoc 中编写了一个示例:https://pypi.org/project/webdriver-manager/

© www.soinside.com 2019 - 2024. All rights reserved.