In Selenium WebDriver, there is one method setScriptTimeout(time, unit)
. If we look at its description, it's
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, then the script will be allowed to run indefinitely.
I've two questions here -
- I'm confused when this should be used. If someone explains it with an example, it would be really helpful
- If I set some time for
setScriptTimeout
, then before executing each Selenium command(like finding element, clicking on it etc) does it wait for specified time for all javascripts of page to complete it's execution?