Conditional Waits Between Steps in AI Recorder
Use the Conditional Wait step in the AI Recorder to pause test execution until a specific condition on an element is satisfied. This is useful when the wait time depends on dynamic UI behavior, such as a button becoming enabled, a checkbox being checked, a loader disappearing rather than a fixed delay.
Unlike the Sleep step, which waits for a set time, Conditional Wait ensures smoother execution by continuing immediately once the condition is met or after the timeout expires, whichever comes first.
This step does not fail the test if the condition is not met within the timeout. It waits until the timeout completes and then moves to the next step.
Add a Conditional Wait Step
Open the AI Recorder and begin editing or recording a scenario.
Click the + (Add a step type) button and select Add a conditional wait step from the list.
Select the element to which the condition is applied.
Choose one of the available conditions:
- Checked / Unchecked (only available for checkboxes, radio inputs, and option elements)
- Visible / Hidden
- Enabled / Disabled
- Editable
Note
The list of available conditions may vary based on the selected element. The Recorder dynamically adjusts the condition options according to the element's properties.
Enter the timeout duration in milliseconds (default is 1000 ms). You can increase it if the condition typically takes longer to become true. Click Save to insert the step.
The scenario pauses test execution at this step until it meets the specified condition on the element or reaches the timeout duration.
Behavior During Test Execution
If the test meets the condition within the timeout, it immediately proceeds to the next step.
If it doesn't meet the condition in time, it waits for the full duration, displays a warning, and then moves to the next step without failing the scenario.
How It Appears
Gherkin Scenario
In the Features page, the Conditional Wait step is displayed as:
Then Wait "X" seconds for element to be [condition] This label reflects the selected element, the specified condition, and the timeout duration set during recording.
Reports
The Reports page shows the Conditional Wait step with the same label and a status indicator after the test executes.
- The step is marked green if the condition is met within the timeout.
- If the test doesn't meet the condition within the timeout, the step displays a warning icon and uses a different style to indicate that the wait timed out, but it does not fail the scenario.