简体   繁体   English

超时错误:[WinError 10060]:

[英]TimeoutError: [WinError 10060] :

I am trying to connect to my firefox browser with selenium.我正在尝试使用 selenium 连接到我的 firefox 浏览器。

#Initialise Firefox
print("here")
locationofDriver = "C:/Users/barry/OneDrive/Documents/Webdriver/"
print("here2")
driver = webdriver.Firefox(locationofDriver)
print("here3")

Yet I get two errors:然而我得到两个错误:

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

And:和:

urllib3.exceptions.ProtocolError: ('Connection aborted.', TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None))

The Output from the print statements:打印语句中的 Output:

here
here2

I launched Firefox manually to see if their was an issue, however it is perfectly functional The web-driver is in the correct place.我手动启动了 Firefox 以查看它们是否有问题,但是它功能完美 Web 驱动程序位于正确的位置。 在此处输入图像描述

Any help appreciated.任何帮助表示赞赏。

Instead providing only the location of the WebDriver executable you need to provide the absolute path of the ChromeDriver / GeckoDriver along with the extension ie .exe .而是只提供WebDriver可执行文件的位置,您需要提供ChromeDriver / GeckoDriver绝对路径以及扩展名,即.exe So your effective code block will be:因此,您的有效代码块将是:

  • For ChromeDriver :对于ChromeDriver

     locationofDriver = r'C:/Users/barry/OneDrive/Documents/Webdriver/chromedriver.exe'
  • For GeckoDriver :对于GeckoDriver

     locationofDriver = r'C:/Users/barry/OneDrive/Documents/Webdriver/geckodriver.exe'

Finally, you can pass the key executable_path along the value as follows:最后,您可以将key executable_path沿传递,如下所示:

driver = webdriver.Firefox(executable_path=locationofDriver)

try it:试试看:

locationofDriver = "<path to file>/geckodriver.exe"

Or add geckodriver.exe to directory with working python file and then you can try:或者将geckodriver.exe添加到具有工作 python 文件的目录中,然后您可以尝试:

driver = webdriver.Firefox()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TimeoutError: [WinError 10060] 连接尝试失败 - TimeoutError: [WinError 10060] A connection attempt failed Python 套接字在其他计算机上超时。 超时错误:[WinError 10060] - Python socket timing out on other computer. TimeoutError: [WinError 10060] 解析学校网站时出现TimeoutError:[WinError 10060] - I get TimeoutError: [WinError 10060] when I parsing my school website TimeoutError: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应或### - TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time or### TimeoutError:[WinError 10060] 连接尝试失败:除了块也不执行 - TimeoutError: [WinError 10060] A connection attempt failed : Except block doesn't execute either Python ftplib WinError 10060 - Python ftplib WinError 10060 带有代理的 Python 请求因 WinError 10060 失败 - Python requests with proxy failing for WinError 10060 如何克服urlopen错误[WinError 10060]问题? - How to overcome urlopen error [WinError 10060] issue? Python-requests [('连接中止。', TimeoutError(10060) ] - Python-requests [('Connection aborted.', TimeoutError(10060) ] WinError 10060 python 通过路由器连接 python 插座 - WinError 10060 python connect python socket through router
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM