Skip to main content

Smart Wait function

This article shows you how to enable and use the Smart Wait function in Katalon Studio. Smart Wait addresses the timing issue in automated web testing by ensuring that all relevant front-end processes of a page to complete before taking further test steps. This helps reduce the risk of test failures because the page has not fully loaded. Katalon Studio allows you to use the Smart Wait function as a browser extension. Download the Smart Wait sample project from our GitHub repository: Smart Wait sample tests.

Notes
  • From Katalon Studio 10.0.0, Smart Wait no longer requires an unpacked extension in browsers that support BiDi (Bidirectional communication), including Chrome, Edge, Firefox, and headless browsers.
    • For environments that do not support BiDi (such as Safari, remote browsers, or TestCloud environments), Smart Wait still requires an unpacked extension to operate correctly.
    • To disable BiDi for environments that don't support it, set the following in the desired capabilities:
      "webSocketUrl": false

Smart Wait in Katalon Studio version 10.3.0 vs Previous Versions

In Version 10.3.0, Katalon Studio introduces a significant upgrade to the Smart Wait mechanism to deliver more reliable and accurate element interactions during test execution.

This comparison table highlights the key differences between the Smart Wait implementation in previous versions of Katalon Studio and the enhanced version introduced in Katalon Studio 10.3.0:

Smart Wait FeatureIn KS Version 10.3.0+Prior to KS Version 10.3.0
Wait for Element InteractivityYes – includes visibility, animation, topmost, and editabilityBefore 10.3.0: No – presence in DOM only
Retry on ExceptionYes – retries on ElementNotInteractableException, StaleElementReferenceException, JavaScript errorsOnly after timeout or element-not-found
DOM Change AwarenessUses mutation observers for dynamic contentBasic polling only
Visibility ChecksDetects hidden, off-screen, zero-sized, and obstructed elementsBasic visibility checks only
Animation AwarenessWaits for animations and transitions to completeNo animation handling
Scroll-into-view strategyCenter alignment, retries on obstructionSingle alignment, no retry
Background Request FilteringFilters out long polling, analytics, SSE; respects UI-impacting requestsWaits on all AJAX/fetch/SSE until timeout
Error ReportingClearer diagnostic messagesGeneric timeout errors
API Injection SafetyUses proxy-based injection for safer executionRisky overrides of native browser APIs
Frame and Shadow DOM SupportFast detection with DOM watchersSupported but slower and less reliable
Browser SupportChrome, Firefox, Edge, headless (BiDi-enabled environmentsChrome, Firefox (extension required)

Enable/Disable 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

You can also dynamically control it per test step by using the enableSmartWait keyword. For example:

WebUI.enableSmartWait()
// ...steps where SmartWait applies...

You can also disable Smart Wait through Project > Settings > Execution > Web UI > Default Smart Wait, or you can use keywords during test execution.

You can also dynamically control it per test step by using the disableSmartWait keyword. For example:

WebUI.disableSmartWait()
// ...steps to skip waiting...

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.

```jsx
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()
Was this page helpful?