A connection with the Remote WebDriver server. Communicates with the server using the WebDriver wire protocol: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
| 157 | |
| 158 | |
| 159 | class RemoteConnection: |
| 160 | """A connection with the Remote WebDriver server. |
| 161 | |
| 162 | Communicates with the server using the WebDriver wire protocol: |
| 163 | https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol |
| 164 | """ |
| 165 | |
| 166 | browser_name: str | None = None |
| 167 | # Keep backward compatibility for AppiumConnection - https://github.com/SeleniumHQ/selenium/issues/14694 |
| 168 | import os |
| 169 | import socket |
| 170 | |
| 171 | import certifi |
| 172 | |
| 173 | _timeout = socket.getdefaulttimeout() |
| 174 | _ca_certs = os.getenv("REQUESTS_CA_BUNDLE") if "REQUESTS_CA_BUNDLE" in os.environ else certifi.where() |
| 175 | _client_config: ClientConfig |
| 176 | |
| 177 | system = sys.platform |
| 178 | if system == "darwin": |
| 179 | system = "mac" |
| 180 | |
| 181 | # Class variables for headers |
| 182 | extra_headers = None |
| 183 | user_agent = f"selenium/{__version__} (python {system})" |
| 184 | |
| 185 | @property |
| 186 | def client_config(self): |
| 187 | return self._client_config |
| 188 | |
| 189 | @classmethod |
| 190 | def get_timeout(cls): |
| 191 | """Returns timeout value in seconds for all http requests made to the Remote Connection. |
| 192 | |
| 193 | Returns: |
| 194 | Timeout value in seconds for all http requests made to the |
| 195 | Remote Connection |
| 196 | """ |
| 197 | warnings.warn( |
| 198 | "get_timeout() in RemoteConnection is deprecated, get timeout from client_config instead", |
| 199 | DeprecationWarning, |
| 200 | stacklevel=2, |
| 201 | ) |
| 202 | return cls._client_config.timeout |
| 203 | |
| 204 | @classmethod |
| 205 | def set_timeout(cls, timeout): |
| 206 | """Override the default timeout. |
| 207 | |
| 208 | Args: |
| 209 | timeout: timeout value for http requests in seconds |
| 210 | """ |
| 211 | warnings.warn( |
| 212 | "set_timeout() in RemoteConnection is deprecated, set timeout in client_config instead", |
| 213 | DeprecationWarning, |
| 214 | stacklevel=2, |
| 215 | ) |
| 216 | cls._client_config.timeout = timeout |
no outgoing calls