Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[py] Remote connection use timeout from ClientConfig #14692

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion py/selenium/webdriver/chromium/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def __init__(
ignore_proxy: Optional[bool] = False,
client_config: Optional[ClientConfig] = None,
) -> None:
client_config = client_config or ClientConfig(remote_server_addr=remote_server_addr, keep_alive=keep_alive)
client_config = client_config or ClientConfig(
remote_server_addr=remote_server_addr, keep_alive=keep_alive, timeout=120
)
super().__init__(
ignore_proxy=ignore_proxy,
client_config=client_config,
Expand Down
4 changes: 3 additions & 1 deletion py/selenium/webdriver/firefox/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def __init__(
ignore_proxy: Optional[bool] = False,
client_config: Optional[ClientConfig] = None,
) -> None:
client_config = client_config or ClientConfig(remote_server_addr=remote_server_addr, keep_alive=keep_alive)
client_config = client_config or ClientConfig(
remote_server_addr=remote_server_addr, keep_alive=keep_alive, timeout=120
)
super().__init__(
ignore_proxy=ignore_proxy,
client_config=client_config,
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
self.service.start()

client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive)
client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
executor = RemoteConnection(
ignore_proxy=options._ignore_local_proxy,
client_config=client_config,
Expand Down
6 changes: 3 additions & 3 deletions py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,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, timeout=120):
diemol marked this conversation as resolved.
Show resolved Hide resolved
def _request(self, method, url, body=None):
"""Send an HTTP request to the remote server.

:Args:
Expand All @@ -397,12 +397,12 @@ def _request(self, method, url, body=None, timeout=120):
body = None

if self._client_config.keep_alive:
response = self._conn.request(method, url, body=body, headers=headers, timeout=timeout)
response = self._conn.request(method, url, body=body, headers=headers, timeout=self._client_config.timeout)
statuscode = response.status
else:
conn = self._get_connection_manager()
with conn as http:
response = http.request(method, url, body=body, headers=headers, timeout=timeout)
response = http.request(method, url, body=body, headers=headers, timeout=self._client_config.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)
Expand Down
4 changes: 3 additions & 1 deletion py/selenium/webdriver/safari/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def __init__(
ignore_proxy: Optional[bool] = False,
client_config: Optional[ClientConfig] = None,
) -> None:
client_config = client_config or ClientConfig(remote_server_addr=remote_server_addr, keep_alive=keep_alive)
client_config = client_config or ClientConfig(
remote_server_addr=remote_server_addr, keep_alive=keep_alive, timeout=120
)
super().__init__(
ignore_proxy=ignore_proxy,
client_config=client_config,
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/safari/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
if not self.service.reuse_service:
self.service.start()

client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive)
client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
executor = SafariRemoteConnection(
ignore_proxy=options._ignore_local_proxy,
client_config=client_config,
Expand Down
Loading