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

1586010002-jmsa.png

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
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值