The internet can be a very unforgiving place. Connectivity issues, third parties, hosting outages and traffic increases can all have an impact on how fast a website loads in the browser. For this reason, it is very important to make your script as resilient as possible.
We recommend always adding a WaitForElement action with the condition of “Clickable” before every Click Action. This is so that the software waits until something is Clickable before attempting to click it. The WaitForElement Actions have a Timeout option which can be used to adjust how long you are happy for the condition to take to be met before moving on.
We also recommend adding WaitForElement actions with the condition of “Visible” before any action that interacts with a form on a page. This is to ensure that the website has enough time to render the element that is required by the next Action.
Consider this example:
The WaitForElement at Step 1, Action A is to ensure that the Click at the start of Step 2 is Clickable.
The WaitForElement at Step 2, Action B is to ensure that the Form has loaded before we try to use it. Step 2, Action C then allows time for the Submit button to become Clickable – this is not entirely necessary, but good practice.
Adding these kinds of actions means that scripts are a lot more resilient to slowdowns or issues that may crop up during tests that cannot be predicted. They also act as additional ways to alert you if the website is not behaving as expected.