Skip to content

[🐛 Bug]: Caused by NewConnectionError #15298

Open
@impactro

Description

@impactro

What happened?

In the most recent version, when a NewConnectionError occurs, the exception crashes the entire Python program and closes it.
see the stack received.

How can we reproduce the issue?

This is the relevant code I am using

options = webdriver.EdgeOptions()
options.add_argument("--headless=new")
options.add_argument("--window-position=-2400,-2400")
driver = webdriver.Edge(options)
driver.set_window_size(areaWidth+fixWith, areaHeight+fixHeight)
driver.get(browseURL)

Relevant log output

12:04:50.308 E BROWSER: HTTPConnectionPool(host='localhost', port=53006): Max retries exceeded with url: /session/de9d3fd0be8e4fd39b2ee2cbbaf42280/screenshot (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001D299E5E5D0>: Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente')):Traceback (most recent call last):
  File "urllib3\connection.py", line 198, in _new_conn
  File "urllib3\util\connection.py", line 85, in create_connection
  File "urllib3\util\connection.py", line 73, in create_connection
ConnectionRefusedError: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "urllib3\connectionpool.py", line 787, in urlopen
  File "urllib3\connectionpool.py", line 493, in _make_request
  File "urllib3\connection.py", line 445, in request
  File "http\client.py", line 1298, in endheaders
  File "http\client.py", line 1058, in _send_output
  File "http\client.py", line 996, in send
  File "urllib3\connection.py", line 276, in connect
  File "urllib3\connection.py", line 213, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001D299E5E5D0>: Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "libs\canvaBrowser.py", line 324, in _runBrowser
  File "selenium\webdriver\remote\webdriver.py", line 1003, in get_screenshot_as_base64
  File "selenium\webdriver\remote\webdriver.py", line 427, in execute
  File "selenium\webdriver\remote\remote_connection.py", line 404, in execute
  File "selenium\webdriver\remote\remote_connection.py", line 428, in _request
  File "urllib3\_request_methods.py", line 135, in request
  File "urllib3\_request_methods.py", line 182, in request_encode_url
  File "urllib3\poolmanager.py", line 443, in urlopen
  File "urllib3\connectionpool.py", line 871, in urlopen
  File "urllib3\connectionpool.py", line 871, in urlopen
  File "urllib3\connectionpool.py", line 871, in urlopen
  File "urllib3\connectionpool.py", line 841, in urlopen
  File "urllib3\util\retry.py", line 519, in increment
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=53006): Max retries exceeded with url: /session/de9d3fd0be8e4fd39b2ee2cbbaf42280/screenshot (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001D299E5E5D0>: Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente'))

Operating System

Windows x64

Selenium version

4.27.1

What are the browser(s) and version(s) where you see this issue?

not local installed

What are the browser driver(s) and version(s) where you see this issue?

Web Driver chrome 133.0.6943.98

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!C-pyPython BindingsD-chromeI-defectSomething is not working as intended

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions