Solving Wait-time issue with Katalon Studio

Automation execution usually does not carry out exactly as scripted due to many factors involved during execution such as network stability, internet bandwidth, the performance of the AUT, and the performance of the executing computer. This article will guide users through leveraging delayed time to handle such situations.

What is Wait?

Using delayed time is a common practice in test automation scripts to create a pause in-between automation steps as you wait for web elements to load or for the AUT to respond.

Here are some examples of test failure due to insufficient waiting time:

  • False Fail: One of the most common failures is when a script fails due to waiting on the application. It is often caused by network latency, delayed database requests, or simply because the system needs more time to process and respond to the request.
  • Targeted element not present on the page: This kind of failure occurs when waiting for elements to be displayed or rendered in the browser. The application may be up and running but certain elements may not be loaded, thus causing test scripts to fail.

How to address those failures related to Wait?

Katalon provides keywords dedicated to delay explicitly. You can use the following options to address the situation:

  • Wait For Page Load This logic will wait for a page to completely load before running a step in your script.
  • Wait For Element Present It happens sometimes that web elements take longer time to appear on the page. This keyword pauses execution until the targeted element appears on the page. Once the element appears, the test continues to execute the next action.
  • Global variable This variable has the global scope, meaning that it is visible throughout the program. Thus, you can use this variable in your test scripts according to the response time of your web application. You may consider defining 3 kinds of global variable in your test scripts, for short, medium, and long waits.

For example: The script below shows the usage of a global variable and the use of Katalon Studio built-in keyword Wait For Element Present to deliberately wait for a specific test element.

Figure 1: Katalon Studio test script

When to use Wait Commands

Quite often test execution get failed due to the exceptions such as ‘NoSuchElementException‘, ‘ElementNotFoundException‘, ‘ElementNotVisibleException‘. In order to handle these exceptions, conditional Synchronization has to be implemented. Katalon Studio supports many built in “Wait for….” keywords to deal with such exceptions. For example:

Keyword Description
Wait For Element Present Wait for the given element to present (appear) within the given time in seconds.
Wait For Element Visible Wait until the given web element is visible within timeout.
Wait For Alert Wait for a browser’s alert to present.
Wait for Element Clickable Wait for the given element to be clickable within the given time in seconds.


thumb_up (23) thumb_down (10)

Resolve Git conflicts using Katalon Studio

1. Why do we have Git conflicts? In a source control system like Git, conflicts may occur when two or…

Automation testing of Shadow DOM elements with Katalon Studio

What is Shadow DOM? Shadow DOM is a technique to help web developers to better encapsulate their code. Shadow DOM…

Detecting elements with Xpath in Katalon Studio

Detecting UI elements of the application under test (AUT) is crucial for automation testing since they are the main objects…
Scroll up