I’m attempting to speed up some workflows by applying some best practices surrounding timeouts. Let’s say my application has a page that can take up to 60 seconds to load. However, if the data source behind the screen is down, I may get an error page after a few seconds.
The straightforward method would be to use a 60-second timeout on the first operation on the page, and if it times out that suggests that something must have gone wrong. But I want my workflow to be intelligent enough to detect the error page as soon as it loads, and avoid waiting the full 60 seconds.
What is the most elegant way to accomplish this? I could loop continuously, looking for an element on both pages until one is found, but that just smells wrong to me. Is there a way to do some sort of conditional find element where the robot will execute a different sequence based on which one is found first? Or some other strategy?