Skip to main content

Smart Wait Function

This article shows you how to enable and use the Smart Wait function in Katalon Studio.

Description

The Smart Wait function tackles the timing issue of automated web testing by automatically waiting for all front-end processes of a page to complete before taking further test steps.

Katalon Studio introduced Smart Wait from version 7.0.0 as a browser extension.

You can download the Smart Wait sample project from our GitHub repository: Smart Wait sample tests.

Requirements

The following are the minimum requirements to use the Smart Wait function:
  • Katalon Studio version 7.0.0 and later for Chrome.

  • Katalon Studio version 8.2.0 and later for Edge Chromium and Firefox.

Enable Smart Wait in Katalon Studio

Smart Wait is enabled by default in Project > Settings > Execution > WebUI. This default configuration will automatically apply Smart Wait to all elements in that project.
smart wait

Temporarily turn off Smart Wait

The Default Smart Wait function is enabled.

You can use the enableSmartWait and disableSmartWait keywords to enable/disable Smart Wait during the test temporarily.

Use the enableSmartWait or disableSmartWait keywords to enable/disable Smart Wait on your target elements.

In the following example, we first use the disableSmartWait keyword to disable Smart Wait at the beginning of the test temporarily.

Then we use the enableSmartWait keyword to enable Smart Wait when setting text on the Username object. Smart Wait is enabled until the disableSmartWait keyword is applied.

WebUI.disableSmartWait()

WebUI.openBrowser('')

WebUI.navigateToUrl('https://store.katalon.com/')

WebUI.maximizeWindow()

WebUI.click(findTestObject('signin-link'))

WebUI.enableSmartWait()

WebUI.setText(findTestObject('username'), 'demo@katalon.com')

WebUI.setEncryptedText(findTestObject('password'),'3zBGMH+v8QQXwX1AbEAx2g==')

WebUI.click(findTestObject('signin-button'))

WebUI.click(findTestObject('menu-dropdown'))

WebUI.click(findTestObject('dashboard-item'))

WebUI.click(findTestObject('plugins-item'))

WebUI.disableSmartWait()

WebUI.closeBrowser()

Workaround for remote execution

The following is a workaround for applying Smart Wait extension for remote execution.

To apply Smart Wait for remote execution in Chrome for Katalon Studio, follow these steps:

  1. In the node machine
    1. Download a Katalon .zip package. You can download different versions of the Katalon package from our GitHub repository: Katalon releases.
    2. Unzip the file and locate the Smart Wait folder.

      For macOS: <Katalon Studio folder>/Contents/Eclipse/configuration/resources/extensions/Chrome/Smart Wait

      For Windows: <Katalon Studio folder>\configuration\resources\extensions\Chrome\Smart Wait

  2. In the test runner machine: The test runner machine is where you install Katalon Studio and store the test scripts.
    1. Open Katalon Studio.
    2. Go to Project > Settings > Desired Capabilities > Remote, then fill in the following information:
      • Remote Server URL: http://localhost:port/wd/hub - the URL of the hub machine.

      • Remote Server Type: Choose Selenium.

      • Click Add on the command toolbar, then input the following values:

        NameTypeValue
        browserNameStringchrome
        goog:chromeOptionsDictionaryClick More (...). In the pop-up Dictionary Property Builder dialog, click Add, then input values from Table 2.
        NameTypeValue
        argsListload-extension=<the absolute path to the Smart Wait folder located in the node machine>

        Apply Smart Wait for remote execution in Chrome