Documentation

Looking for something in particular?

Wait For Test Step

This test step is used to wait for a specific condition before proceeding further in the test. You can also define the maximum number of attempts to be made.

Drag the Wait For test step from the Test Palette into your test case:

Update the following parameters:

  • Condition: The condition to be reached for the test to continue. You can define this using the inbuilt editors
  • Test First: Tick this checkbox to test the condition first
  • Max Attempts: The maximum number of attempts to be made
  • Sleep For (seconds): The time in seconds that the sleep time should last
  • Continue on failure: Tick this checkbox if the wait-for should continue after failure

Then, save the test case.

Example: Wait For an Element To Appear

Before your test can continue running, the page needs to be loaded successfully. Instead of having your test fail because of a page load, you can set up your test using the Wait For step to wait for a field to become visible on the page. Once that field is visible, your test can proceed.

Step 1: In order for you to know if a field is visible or not, you will need to perform a UI Assert on the element. Once you map the element and execute the step, the UI Assert step stores everything about that element into a result called “Values.”

Step 2: You may be wondering “Won’t the step fail if the element isn’t on the page yet?” Without proper configuration, yes.

You can add an “Expected Exception” to your UI Assert step to handle this. We’re expecting the assertion to fail if the element is on the page. Click the “Add a new Expected Exception” icon and fill out the parameters.

The “Title” is what will appear in your results to add information about why this failure is expected.

The “Condition” is checking the error message that is thrown. In the screenshot below, we’re expecting the failure message to contain the word “Error.”

Once configured properly, this step will pass even though the element has not appeared on the page yet.

Step 3: Now that you’ve captured the element, you need to tell your test to wait for it to appear. Add the Wait For step from the Test Palette and configure it to check the element’s visibility. In the Condition field, use Content Assist to call “Values” and use dot notation to refer to the visibility. In the screenshot below, I’m checking to see if the visibility is true.

Tip: Increase the default “Max Attempts” and reduce the “Sleep For (seconds)” for faster results. The screenshot above is modified to check the condition 30 times every second instead of the default check of 5 times every 30 seconds.

This step will check the condition for the amount of attempts that you have set up before continuing the test. By default, if the condition is never met after the specified number of attempts, the test will fail.

If you would like your test to continue running if the condition isn’t met, simply check the “Continue on Failure” checkbox.

Step 4: Copy your UI Assert step and paste it within the Wait For test step. This will execute the UI Assert step again to check the field and see if it is visible. This repopulates the “Value” and provides your condition with the latest information about the field.

Once you have this step configured properly, you can continue adding more test steps. Now your test is set up to check and make sure an element is visible before proceeding.

Review Provar on G2
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top