MagicPod provides various Wait Commands to help improve test stability.
There are two types of wait commands: fixed-time waits using Wait for fixed seconds, and conditional waits that pause until a specific condition is met, such as Wait until UI element is visible. We recommend avoiding fixed-time waits whenever possible. Not only do they unnecessarily extend execution time, but depending on the environment, the wait duration may be insufficient, causing tests to fail. Instead, we recommend using conditional waits such as "Wait until UI element is visible." Since execution proceeds to the next step the moment the condition is met, tests can run faster and more reliably.
Here, we will explain several conditional wait commands and how to use them appropriately.
- Wait until screen is rendered
- Difference Between “Wait until UI element exists” vs “Wait until UI element is visible”
Wait until screen is rendered
The Wait until screen is rendered command detects completion by checking for a period of no visible changes on the screen.
Because of this, it may FAIL to detect rendering completion correctly on continuously dynamic web pages, such as:
- Pages with embedded videos
- Pages whose banner images rotate every few seconds, etc.
Additionally, if the screen momentarily stops changing during page load, the command may falsely interpret that as rendering being complete and proceed to the next step prematurely.
In such cases, using the “Wait until UI element is visible” or “Wait until UI element exists” command—targeting a UI element that appears only after rendering finishes—can provide more stable operation.
Difference Between “Wait until UI element exists” vs “Wait until UI element is visible”
The Wait until UI element exists command waits until the target UI element is detected in the UI tree. (As for the Wait until UI element does not exist command, it detects when the element does not exist.) At this point, whether the element is visible or not does not affect the detection.
On the other hand, the Wait until UI element is visible command waits until the target UI element is confirmed to be visibly displayed. Therefore, even if the element exists in the UI tree, it will not be detected if it is in one of the following hidden states:
- display: none;
- visibility: hidden;
- opacity: 0;
Conversely, the Wait until UI element is invisible command will detect the element when it is in the above hidden states.
For this reason, “Wait until UI element is visible” is generally more stable and recommended, as it ensures the element is truly visible before proceeding.
However, when testing mobile apps on iOS, the “Wait until UI element is visible” command can behave unpredictably. In such cases, please use “Wait until UI element exists” instead.
| Command | Content | Stability | Supported on iOS |
| Wait until UI element exists |
Wait until the UI element appears in the UI tree |
◯ |
◯ |
| Wait until UI element is visible | Wait until the UI element is visible on the screen | ◎ | △ |