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

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions py/selenium/webdriver/chromium/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ 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, timeout=120
)
super().__init__(
remote_server_addr=remote_server_addr,
keep_alive=keep_alive,
ignore_proxy=ignore_proxy,
client_config=client_config,
)
Expand Down
5 changes: 3 additions & 2 deletions py/selenium/webdriver/firefox/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ 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, timeout=120
)
super().__init__(
remote_server_addr=remote_server_addr,
keep_alive=keep_alive,
ignore_proxy=ignore_proxy,
client_config=client_config,
)
Expand Down
5 changes: 3 additions & 2 deletions py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

from selenium.webdriver.common.driver_finder import DriverFinder
from selenium.webdriver.remote.client_config import ClientConfig
from selenium.webdriver.remote.remote_connection import RemoteConnection
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

Expand Down Expand Up @@ -49,10 +50,10 @@ 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, timeout=120)
executor = RemoteConnection(
remote_server_addr=self.service.service_url,
keep_alive=keep_alive,
ignore_proxy=options._ignore_local_proxy,
client_config=client_config,
)

try:
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):
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
5 changes: 3 additions & 2 deletions py/selenium/webdriver/safari/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ 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, timeout=120
)
super().__init__(
remote_server_addr=remote_server_addr,
keep_alive=keep_alive,
ignore_proxy=ignore_proxy,
client_config=client_config,
)
Expand Down
5 changes: 3 additions & 2 deletions py/selenium/webdriver/safari/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

from selenium.common.exceptions import WebDriverException
from selenium.webdriver.remote.client_config import ClientConfig
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

from ..common.driver_finder import DriverFinder
Expand Down Expand Up @@ -50,10 +51,10 @@ 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, timeout=120)
executor = SafariRemoteConnection(
remote_server_addr=self.service.service_url,
keep_alive=keep_alive,
ignore_proxy=options._ignore_local_proxy,
client_config=client_config,
)

try:
Expand Down
Loading