Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ConnectionResetError:[WinError 10054]尝试使用Selenium Webdriver Python代码访问网站时出错_Python_Sockets_Selenium_Selenium Webdriver - Fatal编程技术网

ConnectionResetError:[WinError 10054]尝试使用Selenium Webdriver Python代码访问网站时出错

ConnectionResetError:[WinError 10054]尝试使用Selenium Webdriver Python代码访问网站时出错,python,sockets,selenium,selenium-webdriver,Python,Sockets,Selenium,Selenium Webdriver,我不熟悉SeleniumWebDriver,我正在尝试使用python通过SeleniumWebDriver访问特定网站。我得到以下错误: Traceback (most recent call last): File "test.py", line 9, in <module> driver = webdriver.Firefox() File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\web

我不熟悉SeleniumWebDriver,我正在尝试使用python通过SeleniumWebDriver访问特定网站。我得到以下错误:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    driver = webdriver.Firefox()
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 85, in __init__
    keep_alive=True)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 432, in _request
    resp = self._conn.getresponse()
  File "C:\Python34\lib\http\client.py", line 1172, in getresponse
    response.begin()
  File "C:\Python34\lib\http\client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "C:\Python34\lib\http\client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Python34\lib\socket.py", line 371, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

我也有同样的问题。然后我使用其他版本的Firefox,如下所示:


然后解决问题。

即使在我试图打开google.com页面时,我也看到了这个问题
import socket, sys
import errno
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 


driver = webdriver.Firefox()
driver.get("http://xx.xx.xx.xx:9191")
print (driver.title)

try:
  WebDriverWait(driver, 10).until(EC.title_contains("manager"))
  print (driver.title)

finally:
    driver.quit()