In some testing scenarios, you may want to configure additional waits before executing subsequent test steps. In browser and mobile tests, there are three ways to configure additional waits:
In most cases, Configure Find and wait until steps are the recommended method for configuring additional waits because the total wait time is dynamic. If the application is ready before the set timeout, mabl completes the step and continues to execute the next steps.
Wait steps, on the other hand, always wait for a specific amount of time. Wait steps can be useful for isolating performance issues during test execution or capturing a screenshot of the page at a specific point in the test. As a general rule, we recommend using wait steps sparingly because they can slow down the feedback cycle of your tests.
This article explains how to add the three different types of waits to a browser or mobile test.
When a browser test executes in the cloud, mabl uses Intelligent Wait to make sure your application is in the correct state before interacting with elements on the page. In some cases, however, you may want to configure additional waits.
Configure Find
All find actions in mabl, including assertions and clicks, automatically wait up to 30 seconds for the target element to appear. If the element takes longer than 30 seconds to appear in your app, or if the element comes into existence without being fully realized, you can use Configure Find.
Configure Find allows you to:
- specify which element attributes mabl should look for
- set a timeout to define how long mabl should look for the element
Defining a timeout for a Configured Find
The default timeout for Configure Find steps is 15 seconds, but you may set the timeout to wait up to 15 minutes (900 seconds) before finding and interacting with the target element. For more information on using Configure Find, check out this guide.
Wait until steps
Wait until steps wait up to a maximum number of seconds for a specific element to be present on the page. If mabl finds the target element before the timeout, the wait is complete and mabl moves on to the next step.
Wait until steps are less static than wait steps and less rigid than using CSS and XPath queries to find an element. Use wait until steps to specify a timeout and the attributes that mabl should wait for before attempting to auto-heal.
To add a wait until step in the mabl Trainer, take the following steps:
- Click on the plus icon at the bottom of the Trainer window to add a step.
- Click on Wait.
- Select "Add wait until."
Adding a wait until step
- Select the element that mabl should wait for.
- Check the attributes that you would like mabl to target. The available attributes are based on the element that you selected.
Selecting attributes
- Click Next.
- Configure a maximum wait up to 900 seconds.
- Indicate whether you would like mabl to auto-heal if a matching element is not found.
- Click OK.
When working with wait until steps, keep in mind the following limitations:
- You cannot use CSS or XPath to identify the target element for a wait until step.
- Wait until steps cannot wait until an element is absent. If your test must wait until an element is absent, try using the looping workflow outlined here.
If you have a use case involving these limitations, please let us know in the mabl Product Portal.
Wait steps
Wait steps, also known as static waits, tell mabl to wait a specific amount of time before moving on to the next step.
To insert a wait step in the mabl Trainer, take the following steps:
- Click on the plus icon at the bottom of the Trainer window to add a step.
- Click on Wait.
- Select "Add wait."
Adding a wait step
- Enter the number of seconds to wait before executing the next step, up to 900 seconds.
- Click OK.