Skip to content

Commit 7c9f000

Browse files
[py] Avoid waiting indefinitely on a frozen chromedriver process (#14578)
Add a default timeout of 2 minutes two requests to the webdriver
1 parent 97c29e7 commit 7c9f000

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: py/selenium/webdriver/remote/remote_connection.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def execute(self, command, params):
305305
LOGGER.debug("%s %s %s", command_info[0], url, str(trimmed))
306306
return self._request(command_info[0], url, body=data)
307307

308-
def _request(self, method, url, body=None):
308+
def _request(self, method, url, body=None, timeout=120):
309309
"""Send an HTTP request to the remote server.
310310
311311
:Args:
@@ -323,12 +323,12 @@ def _request(self, method, url, body=None):
323323
body = None
324324

325325
if self.keep_alive:
326-
response = self._conn.request(method, url, body=body, headers=headers)
326+
response = self._conn.request(method, url, body=body, headers=headers, timeout=timeout)
327327
statuscode = response.status
328328
else:
329329
conn = self._get_connection_manager()
330330
with conn as http:
331-
response = http.request(method, url, body=body, headers=headers)
331+
response = http.request(method, url, body=body, headers=headers, timeout=timeout)
332332
statuscode = response.status
333333
data = response.data.decode("UTF-8")
334334
LOGGER.debug("Remote response: status=%s | data=%s | headers=%s", response.status, data, response.headers)

0 commit comments

Comments
 (0)