python 10053,Python Selenium:WinError 10053-主机正在关闭连接

I started messing around with Python networking using selenium on Firefox. Unfortunately, I keep getting "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine".

However, this only happens when running some commands, and it only happens the first time I run them. If execute the command a second time right after that, it works. (See below for a minimal example.)

I found this question, but being a networking newbie I'm having a hard time applying the solution to my situation. How do I prevent the connection from shutting down?

Any help is greatly appreciated!

from selenium import webdriver

browser = webdriver.Firefox()

browser.get('http://www.google.com/')

searchfield = browser.find_element_by_id("lst-ib") # Runs without issues

searchfield.get_attribute("value") # Produces WinError 10053

searchfield.get_attribute("value") # Returns '' as it should

EDIT: It seems the error only occurs, when I execute the command in the shell, rather than saving and running the whole script. Nonetheless, it's pretty annoying.

解决方案

I got the same problem, my config is:

Firefox 60.0.2 (64 bits)

; geckodriver 0.21.0 ( 64 bits)

; selenium 3.12.0

I resolved this problem by downgrade geckodriver to 0.20.1 ( 64 bits)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用 目录名称无效,这个错误的意思是目录名称无效。根据你提供的代码,你尝试删除了一个文件或文件夹。然而,在删除文件或文件夹之前,你需要确保目录名称是有效的。请检查你提供的路径是否是一个有效的目录路径。可能是由于路径错误或目录不存在导致的。请确保你提供的路径是正确的,并且目录存在。 问题的路径是:'C:\\Users\\1data\\Desktop\\新零售客户系统字段匹对需求\\同心表.xlsx',请确保该路径是正确的,并且目录存在。如果路径是正确的,并且目录确实存在,那么可能是访问权限的问题。你可能需要以管理员权限运行你的代码,或者修改目录的权限,以便你的代码可以访问该目录。确保你有足够的权限来删除该文件或文件夹。 另外,还有一种可能是该文件或文件夹正在被其他程序占用,导致你无法删除它。可以尝试关闭其他占用该文件或文件夹的程序,然后再进行删除操作。 总结起来,你可以按照以下步骤来解决这个问题: 1. 检查路径是否正确,并确保目录存在。 2. 以管理员权限运行你的代码,或者修改目录的权限。 3. 关闭其他占用该文件或文件夹的程序。 4. 如果问题仍然存在,可以尝试使用其他方法或工具来删除该文件或文件夹。 希望以上信息对你有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [[Python黑帽] 一.获取Windows主机信息、注册表、U盘历史痕迹和回收站文件](https://blog.csdn.net/Eastmount/article/details/108416973)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [python Web抓取(二)selenium模块的使用、对浏览器的按键操作及错误处理](https://blog.csdn.net/weixin_34414196/article/details/94688839)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值