[🐛 Bug]: Setting timeouts in Python
What happened?
This may not be a bug, but it confused me, so probably others as well.
To set implicit wait, page load and script timeouts:
On driver instance: use Timeouts() with keys in snake_case and values in seconds
On options instance: use dict with keys in camelCase and values in milliseconds
Should we deprecate Timeouts()? Should we support both?
How can we reproduce the issue?
timeouts = Timeouts(implicit_wait=2, page_load=20)
driver.timeouts = timeouts
and
options = webdriver.ChromeOptions()
options.timeouts = {"implicit": 2000, "pageLoad": 20000}
Relevant log output
n/a
Operating System
n/a
Selenium version
trunk
What are the browser(s) and version(s) where you see this issue?
n/a
What are the browser driver(s) and version(s) where you see this issue?
n/a
Are you using Selenium Grid?
no
I believe both ways are well for setting timeouts in Python.
I see no reason not to continue to support both at the moment, however I would suggest being consistent with snake_case in python.
This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.
I guess my issue here is that these really shouldn't be treated differently, so I think the options are:
- deprecate Timeout and require dict in driver
- deprecate dict and require Timeout in options
- Add dict support to driver and Timeout support to options
- Add dict support to driver and Timeout support to options
I'm down for adding Timeout support to options. If we added dict support to driver, are you thinking it'd look something like:
driver.set_timeout({'timeout':1000, 'implicit':2000, 'pageLoad':3000})
or like:
driver.timeout = {'timeout':1000, 'implicit':2000, 'pageLoad':3000}
Hmm, spending a few more minutes looking at this, and I think the "right" fix I'd make is more trouble than it is worth... So maybe I should just close this.