【问题标题】:Firefox is crashing and I am getting ConnectionResetError when used Python with SeleniumFirefox 正在崩溃,并且在将 Python 与 Selenium 一起使用时出现 ConnectionResetError
【发布时间】:2016-07-13 07:50:32
【问题描述】:

我开始编写一个 python 脚本,该脚本将在网页中导航并为我获取一些必要的数据。

我发现了一个使用 selenium 来浏览互联网的代码。

问题是,当我运行代码时,Firefox 正在崩溃,并且我收到 ConnectionResetError: [WinError 10054] An existing connection wasforced closed by the remote host 错误。

我找不到故障并需要帮助。

这里是代码。

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)

【问题讨论】:

  • 尝试将 Firefox 降级到旧版本
  • 是否有任何特定版本导致此问题?
  • 可能是你can check this

标签: python selenium


【解决方案1】:

对于那些想得到答案的人来说,47 版本的 Firefox 浏览器都有这个问题。因此,我尝试使用低于 47 的版本进行操作。

如果没有必要,我建议使用 Chrome。 (首先你需要下载驱动程序)这样你就不会被这样的东西卡住了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-23
    • 2015-09-17
    • 1970-01-01
    相关资源
    最近更新 更多