I am encountering a "disconnected: Unable to receive message from renderer" error while using Selenium with Chrome WebDriver.
The issue occurs after connecting to a VPN and attempting to open a web page with WebDriver.
I need to start the WebDriver before connecting to the VPN.
Fetching a web page before VPN connection works fine.
I have tried various solutions, including adjusting ChromeOptions, but the error persists.
Could anyone please provide insights or solutions to resolve this issue? Thank you.
import subprocess
import time
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(
options=options
)
subprocess.Popen(
'rasdial "jp-free-09.protonvpn.net"',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True
)
print('Connected to VPN.')
time.sleep(10)
driver.get('https://stackoverflow.com/')
driver.quit()
print('Completed.')
Traceback (most recent call last):
File "c:\Users\****\****\****\****\****.py", line 23, in <module>
driver.get('https://stackoverflow.com/')
File "C:\Users\****\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 355, in get
self.execute(Command.GET, {"url": url})
File "C:\Users\****\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 346, in execute
self.error_handler.check_response(response)
File "C:\Users\****\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools
(failed to check if window was closed: disconnected: not connected to DevTools)
(Session info: chrome=115.0.5790.102)
Stacktrace:
Backtrace:
GetHandleVerifier [0x00A5A813+48355]
(No symbol) [0x009EC4B1]
(No symbol) [0x008F5358]
(No symbol) [0x008E7D96]
(No symbol) [0x008E7AB9]
(No symbol) [0x008F67C0]
(No symbol) [0x0094C4D8]
(No symbol) [0x0093A536]
(No symbol) [0x009182DC]
(No symbol) [0x009193DD]
GetHandleVerifier [0x00CBAABD+2539405]
GetHandleVerifier [0x00CFA78F+2800735]
GetHandleVerifier [0x00CF456C+2775612]
GetHandleVerifier [0x00AE51E0+616112]
(No symbol) [0x009F5F8C]
(No symbol) [0x009F2328]
(No symbol) [0x009F240B]
(No symbol) [0x009E4FF7]
BaseThreadInitThunk [0x779200C9+25]
RtlGetAppContainerNamedObjectPath [0x77C87B1E+286]
RtlGetAppContainerNamedObjectPath [0x77C87AEE+238]
Python: 3.11.4
selenium: 4.10.0
webdriver-manager: 3.8.6
Chrome: 115.0.5790.102 (matching ChromeDriver version)