内网使用 python selenium报错,好像总是检查驱动的最新版本

内网(办公室局域网)环境,使用 python selenium 时报错,好像总是检查驱动的最新版本,但是内网又不通外网,所以总是失败,怎样能禁止检查?试过chrome和Firefox都这样,驱动和浏览器都已经是对应的版本了。另外如果切换到外网环境,就能正常执行。

具体报错如下

Exception trying to discover geckodriver version: error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): error trying to connect: tcp connect error: 由于目标计算机积极拒绝,无法连接。 (os error 10061)

Traceback (most recent call last):

  File “c:\python\abcd.py”, line 10, in

    driver = webdriver.Firefox(options=options)

  File “C:\Users\aa\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\webdriver.py”, line 60, in __init__

    self.service.start()

  File “C:\Users\aa\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py”, line 116, in start

    raise WebDriverException(f”Can not connect to the Service {self._path}”)

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service C:\Program Files (x86)\Mozilla Firefox\geckodriver.exe

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/7244a1b190.html