Closed as not planned
Closed as not planned
Description
Description
This have worked on all previous ChromeDriver versions ( <= 135.x) but started to fail as soon as the ChromeDriver was updated to 136.x. This entails that something have been changed in 136.x which causes this issue. Ticket have been written to issues.chromium.org but they said this is out of scope since it's a Selenium error (issue)
Steps to reproduce:
- On Windows 10/11, using Selenium (4.32.0) in Python (3.11.4) and ChromeDriver 136.0.7103.93
- Try instantiate the chrome webdriver (code used can be seen below)
- Exception recieved "selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to chrome at localhost:53959"
The same code works on <= 135.x.
Reproducible Code
def start_chrome_and_attach() -> WebDriver:
"""Start Chrome in remote debugging mode and attaches a selenium driver.
Useful for using selenium on the default browser.
"""
with socketserver.TCPServer(("localhost", 0), None) as s:
free_port = s.server_address[1]
run_command([_get_chrome_executable(), f"--remote-debugging-port={free_port}"])
chrome_options = webdriver.ChromeOptions()
# Set the proxy for downloading the webdriver
# https://github.com/SeleniumHQ/selenium/issues/11294#issuecomment-1684143026
proxy = Proxy({"proxyType": ProxyType.MANUAL})
proxy.http_proxy = Constants.Proxies.proxies["http"]
proxy.ssl_proxy = Constants.Proxies.proxies["https"]
chrome_options.proxy = proxy
chrome_options.add_experimental_option("debuggerAddress", f"localhost:{free_port}")
chrome_options.add_argument("--disable-features=ChromeWhatsNewUI")
chrome_webdriver = webdriver.Chrome(options=chrome_options)
return chrome_webdriver
Debugging Logs
automation_framework\browser_automation\system_web_browser.py:106: in get_link_url
driver = start_chrome_and_attach()
automation_framework\browser_automation\system_web_browser.py:94: in start_chrome_and_attach
chrome_webdriver = webdriver.Chrome(options=chrome_options)
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\chrome\webdriver.py:45: in __init__
super().__init__(
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\chromium\webdriver.py:56: in __init__
super().__init__(
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\remote\webdriver.py:207: in __init__
self.start_session(capabilities)
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\remote\webdriver.py:291: in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\remote\webdriver.py:346: in execute
self.error_handler.check_response(response)
C:\Users\acs\.virtualenvs\UITest-S2COC7wJ\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:229: in check_response
raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to chrome at localhost:57731
E from chrome not reachable
E Stacktrace:
E GetHandleVerifier [0x00007FF7FA69A145+76773]
E GetHandleVerifier [0x00007FF7FA69A1A0+76864]
E (No symbol) [0x00007FF7FA458DAC]
E (No symbol) [0x00007FF7FA449BE1]
E (No symbol) [0x00007FF7FA49C082]
E (No symbol) [0x00007FF7FA49126E]
E (No symbol) [0x00007FF7FA4E5155]
E (No symbol) [0x00007FF7FA4E4710]
E (No symbol) [0x00007FF7FA4D7133]
E (No symbol) [0x00007FF7FA4A04D1]
E (No symbol) [0x00007FF7FA4A1263]
E GetHandleVerifier [0x00007FF7FA95A8ED+2962317]
E GetHandleVerifier [0x00007FF7FA954EC2+2939234]
E GetHandleVerifier [0x00007FF7FA972FF3+3062419]
E GetHandleVerifier [0x00007FF7FA6B4B9A+185914]
E GetHandleVerifier [0x00007FF7FA6BC78F+217647]
E GetHandleVerifier [0x00007FF7FA6A2A44+111844]
E GetHandleVerifier [0x00007FF7FA6A2BF2+112274]
E GetHandleVerifier [0x00007FF7FA688A79+5401]
E BaseThreadInitThunk [0x00007FFCD0E8259D+29]
E RtlUserThreadStart [0x00007FFCD218AF38+40]