selenium: [🐛 Bug]: Timeout env variable GLOBAL_DEFAULT_TIMEOUT has no effect

Description

The timeout is always set to 120 seconds, the env variable has GLOBAL_DEFAULT_TIMEOUT has no effect.

https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/chromium/remote_connection.py#L33

client_config = client_config or ClientConfig( remote_server_addr=remote_server_addr, keep_alive=keep_alive, timeout=120 )

https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/remote/client_config.py#L107 self.timeout = ( ( float(os.getenv("GLOBAL_DEFAULT_TIMEOUT", str(socket.getdefaulttimeout()))) if os.getenv("GLOBAL_DEFAULT_TIMEOUT") is not None else socket.getdefaulttimeout() ) if timeout is None else timeout )

Others: https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/firefox/remote_connection.py#L35 https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/safari/remote_connection.py#L35

Reproducible Code

driver.get("https://github.com/")
driver.implicitly_wait(130)
field = driver.find_element(By.ID, "qwertyzxcvb")

Debugging Logs

/site-packages/urllib3/connectionpool.py", line 369, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=123): Read timed out. (read timeout=120)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (16 by maintainers)

Most upvoted comments

@Pikamander2

I don’t quite understand what I’m supposed to do here and couldn’t find much relevant documentation.

I just opened #15672 that is related to your issue.

Is there a simple drop-in replacement for the driver.command_executor.set_timeout line? Can the timeout still be set dynamically as needed rather than only when the driver is first created?

You should be able to do this:

driver.command_executor._client_config.timeout = 5000

If #15672 gets implemented, you could then do:

driver.command_executor.client_config.timeout = 5000

I’d prefer to remove it so we don’t have to remember to remove the warning eventually. Since it doesn’t currently work, nobody would be any worse off than they are today.