From 7c9f000fccc75da4f49336ac2d2765ddc4350f30 Mon Sep 17 00:00:00 2001 From: David Bernhard Date: Fri, 18 Oct 2024 12:47:15 +0200 Subject: [PATCH] [py] Avoid waiting indefinitely on a frozen chromedriver process (#14578) Add a default timeout of 2 minutes two requests to the webdriver --- py/selenium/webdriver/remote/remote_connection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/selenium/webdriver/remote/remote_connection.py b/py/selenium/webdriver/remote/remote_connection.py index d3a45ae5e4067..e409d2b9c104b 100644 --- a/py/selenium/webdriver/remote/remote_connection.py +++ b/py/selenium/webdriver/remote/remote_connection.py @@ -305,7 +305,7 @@ def execute(self, command, params): LOGGER.debug("%s %s %s", command_info[0], url, str(trimmed)) return self._request(command_info[0], url, body=data) - def _request(self, method, url, body=None): + def _request(self, method, url, body=None, timeout=120): """Send an HTTP request to the remote server. :Args: @@ -323,12 +323,12 @@ def _request(self, method, url, body=None): body = None if self.keep_alive: - response = self._conn.request(method, url, body=body, headers=headers) + response = self._conn.request(method, url, body=body, headers=headers, timeout=timeout) statuscode = response.status else: conn = self._get_connection_manager() with conn as http: - response = http.request(method, url, body=body, headers=headers) + response = http.request(method, url, body=body, headers=headers, timeout=timeout) statuscode = response.status data = response.data.decode("UTF-8") LOGGER.debug("Remote response: status=%s | data=%s | headers=%s", response.status, data, response.headers)