Python webdriver.Remote all of a sudden trigger "WinError 10061 No connection ..." error
Hi, I have a python script that uses selenium to scrape some data from the web. It's been running for months without any problem. One of the things I do occasionally when the script crashes is to use webdriver.Remote to basically continue to work on the browser that was previously opened. the simple line of code that used to work is shared below:
chrome = webdriver.Remote(command_executor=command_executor_val, desired_capabilities={})
Variable 'command_executor_val' is basically a string containing the value 'http://127.0.0.1:53463'. Since about a week, this line of code triggers the error message:
Traceback (most recent call last):
chrome = webdriver.Remote(desired_capabilities=DesiredCapabilities().CHROME, command_executor=command_executor_val)
File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 310, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 466, in execute
return self._request(command_info[0], url, body=data)
File "C:\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 528, in _request
resp = opener.open(request, timeout=self._timeout)
File "C:\Python\Python36-32\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Python\Python36-32\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Python\Python36-32\lib\urllib\request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Python\Python36-32\lib\urllib\request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>
I really have no idea why this is happening. I read Selenium remote webdriver error (Connection refused) and Using an HTTP PROXY - Python and Python urllib.request.urlopen() returning error 10061? but none of them seems to be triggered by webdriver.Remote.
I can't recall having installed anything on my machine. I have windows and Chrome as default browser. Thanks in advance for any suggestions.