• Solving Common Issue – Wait-time – 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 a 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 a 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.

    Here is the link “Katalon Studio Complete Tutorial

    Sharing is caring.

    Share on facebook
    Share on twitter
    Share on linkedin

    Like This Post?

    We have a lot more where that came from?

    We only send really good stuff occasionally, promise.

    Rajkumar SM

    Leave a Comment

    Your email address will not be published. Required fields are marked *

    Share on facebook
    Share on google
    Share on twitter
    Share on linkedin
    Share on whatsapp

    Recent Posts:

    Scroll to Top
    API Testing eBook