What Is a Timeout Strategy?#
How long should the browser wait and keep retrying to interact with an element: 5, 10, or 20 seconds? And what happens when a function times out: Should the browser stop or continue its operation?
Learn how to set the best timeout strategy for the needs and context of your automation workflow.
Settings and Strategy#
TimeoutSettings
defines the TimeoutStrategy
together with a general timeout in seconds. Note that the general timeout often can be shortened or extended by the function-specific timeout. For example:
Python | |
---|---|
Options for TimeoutSettings
#
Parameter | Description |
---|---|
seconds | General timeout and default is 5 seconds. Note that a function-specific timeout overrides this. |
strategy | TimeoutStrategy.STOP (default) or TimeoutStrategy.CONTINUE . |
Options for TimeoutStrategy
#
Option | Description |
---|---|
TimeoutStrategy.STOP | Default. Fail fast upon timeout and raise errors. |
TimeoutStrategy.CONTINUE | Continue despite timeouts and most errors (syntax errors excluded). |
Example#
How to define a general strategy and timeout of 10 seconds for all functions, which we then override to 5 seconds for a specific function: