gpt4 book ai didi

python-3.x - 连接重置错误 : [WinError 10054] When using Selenium Chrome

转载 作者:行者123 更新时间:2023-12-04 16:06:20 25 4
gpt4 key购买 nike

您好,我的代码突然出现了一个简单的问题,直到昨天它都可以正常工作,这意味着它打开了一个网页并输入了登录详细信息(这是对更大应用程序的测试),但是现在每当它尝试连接到登录页面出现超时错误。我已将 Selenium 和 Chrome Web Driver 更新到最新版本,但仍然无法连接,这是我的代码:

#importing libraries, selenium is the base of the script, time to add pauses when appropiate or necessary and select and request will stay until i determine that they are not necessary for the final script.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time
import requests
#defining browser to use the webdriver with chrome, and navigating to Makor.
browser = webdriver.Chrome()
browser.get('http://mrmprod/Login.aspx')

这是完整的错误代码:

Traceback (most recent call last): File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\Scripts\Input test.py", line 7, in browser = webdriver.Chrome() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in init desired_capabilities=desired_capabilities) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in init self.start_session(desired_capabilities, browser_profile) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 407, in execute return self._request(command_info[0], url, body=data) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 439, in _request resp = self._conn.getresponse() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1197, in getresponse response.begin() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 575, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host



我问网络管理员,他告诉我自从我最初让代码工作以来,网络设置没有任何变化。

最佳答案

如果您已查看上述内容,请执行以下步骤:

您必须在括号内包含 chromedriver 路径。

检查下面的代码:

适用于 Windows 操作系统的代码示例

browser = webdriver.Chrome('C:\\User\\YOUR_USERS_NAME\\YOUR_PATH\\chromedriver.exe')

LINUX 操作系统的代码示例
browser = webdriver.Chrome('usr\\bin\\YOUR_PATH\\chromedriver')

关于python-3.x - 连接重置错误 : [WinError 10054] When using Selenium Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40768759/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com