Ошибка: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it


    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    from selenium.common.exceptions import NoSuchElementException
    import time
    
    browser = webdriver.Chrome('C:/Bot/Driver/chromedriver')
    
    def GetInfo(browser):
        browser.set_page_load_timeout(5)
        print('1')
        def EnterSite():
            try:
                browser.get('https://ipay.znaj.by/sso/page/login?auth_return_url=https://znaj.by/Account/LogOn')
            except:
                EnterSite()
    
        EnterSite()
    
    
        time.sleep(3)
        browser.close()
        browser.quit()
    
    
    while True:
        GetInfo(browser)

В ходе выполнения скрипта появляется ошибка

  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
    raise err
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1010, in _send_output
    self.send(msg)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 950, in send
    self.connect()
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 187, in connect
    conn = self._new_conn()
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0313E580>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:/Bot/test.py", line 26, in <module>
    GetInfo(browser)
  File "c:/Bot/test.py", line 9, in GetInfo
    browser.set_page_load_timeout(5)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 947, in set_page_load_timeout
    self.execute(Command.SET_TIMEOUTS, {
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 374, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 397, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\request.py", line 79, in request
    return self.request_encode_body(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\request.py", line 171, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\poolmanager.py", line 336, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 754, in urlopen
    return self.urlopen(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 754, in urlopen
    return self.urlopen(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 754, in urlopen
    return self.urlopen(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "C:\Users\Egor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=50658): Max retries exceeded with url: /session/3eab8dde1c2ceddaa10400a3e852df0c/timeouts (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0313E580>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))```


Ответы (0 шт):