简体   繁体   English

Firefox崩溃了,将Python与Selenium一起使用时出现了ConnectionResetError

[英]Firefox is crashing and I am getting ConnectionResetError when used Python with Selenium

I started working on a python script that is going to navigate through a webpage and going to take some necessary datas for me. 我开始研究一个python脚本,该脚本将浏览网页并为我获取一些必要的数据。

I found a code that uses selenium in it to navigate the internet. 我找到了一个在其中使用硒的代码来浏览互联网。

The problem is, when I run the code, Firefox is crashing and I am getting the ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host error. 问题是,当我运行代码时,Firefox崩溃了,并且我得到了ConnectionResetError:[WinError 10054]现有连接由于远程主机错误而被强制关闭

I couldn't find the glitch and need a help. 我找不到故障,需要帮助。

Here is the code. 这是代码。

from selenium import webdriver

# initiate
driver = webdriver.Firefox() # initiate a driver, in this case Firefox
driver.get("URL_HERE") # go to the url

# log in
username_field = driver.find_element_by_name(Username_here) # get the username field
password_field = driver.find_element_by_name(Password_here) # get the password field
username_field.send_keys("...") # enter in your username
password_field.send_keys("...") # enter in your password
password_field.submit() # submit it

# print HTML
html = driver.page_source
print (html)

For those who wants to have an answer, 47 versioned Firefox browsers have a problem with this. 对于那些想知道答案的人,47种版本的Firefox浏览器对此有问题。 So I've tried to owrk with a lower version then 47 and it worked. 因此,我尝试使用低于47的较低版本进行操作,并且效果良好。

I'd suggest if it is not necessary, use Chrome. 我建议如果不需要,请使用Chrome。 (First you need to download the driver) That way you are not going to stuck with something like this. (首先,您需要下载驱动程序)这样,您就不会陷入类似这样的情况。

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

相关问题 为什么我的基本 python UDP 客户端出现 ConnectionResetError? - Why am I getting a ConnectionResetError for my basic python UDP client? 为什么我在这里得到一个ConnectionResetError? - Why am I getting a ConnectionResetError here? 当我使用 python selenium headless 时出现 tImeout 错误 - Getting tImeout error when I am using python selenium headless 为什么我得到以下mnist = fetch_mldata的connectionreseterror? - Why am I getting the following connectionreseterror for mnist = fetch_mldata? 我在 selenium python 上收到此错误 - I am getting this error on selenium python 我无法让 Firefox 与 Selenium (Python) 一起工作,因为它似乎无法找到 geckodriver.exe - I am having trouble getting Firefox to work with Selenium (Python) as it doesn't seem to be able to find geckodriver.exe 嗨,当使用 python 和 selenium 时,我无法通过 cloudflare 访问使用 DDos 保护的站点 - Hi, I am having problems with getting through to a site using DDos protection by cloudflare, when using python and selenium 从命令行运行python硒脚本时出现固定错误 - I am getting fixture error when running python selenium scripts from command line 重新启动驱动程序实例后,Python Selenium Firefox脚本崩溃 - Python Selenium Firefox script crashing after restarting driver instance selenium python 为什么我没有得到图像 url? - selenium python why I am not getting image url?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM