Why does "Default Smart Wait" Stops Working all of the sudden?

I found myself in the same situation a lot of Katalon users had been through, from one second to the next each test step takes the full “Default wait timeout” (for most of us this is default, 30 seconds), solutions on these forums are always the same “Set ‘Default Smart Wait’ to Disable”. This isn’t a solution but just a workaround.

What is the cause of this issue? What is the fix so I don’t have to disable it?

1 Like

Really hard to think of a reason why with so little information to work with.

Please do read through this post as I do see it is your first time posting in the forums and provide more information regarding your issue:

Things I can think of from the start is to check your version, I am running 8.3.0 and it is working correctly. You might even just need a reinstall of Katalon Studio.

Next is to see if this happens on a new project as well.

And another thing you can check is to see if this happens when you run the same project on a different machine.

Remember a computer has many variables that can cause the problems you are experiencing and it could also be caused by something else and not the Katalon software itself.

1 Like

I went through the document. Unfortunately I can’t provide some of it due to privacy policy in my company such as the web app, screenshots of it and even some parts of the html.

However, I know for a fact this is not a code/script problem (sorry, you gonna have to trust me in this one), the test case passes every time, no errors in the logs, it just simply uses all the timeout time in each step.

Clearly the “smart wait” is waiting for something to happen/finish. I did look for documentation on the matter but I only found that it “Automatically waits for front-end processes”. It really isn’t giving me anything to work with.

I’d appreciate if you can provide more details on how this works so I can perform a specific search of the issue instead of doing general troubleshooting.

And you’re going to have to trust us… without more info, it’s too easy to fall back on “it has to be something you’re doing.” Fact is, if Smart Wait was broken, the forum would be overrun with bug reports.

Take the advice: start a new project from a new install of KS and write a simple TC that will expose the problem wherever it resides.

FYI, and FWIW, I don’t use Smart Wait. Never have. Never will.

I Apologize, I wasn’t clear on my reply. I did follow the advice, the steps, the troubleshooting and the documentation. Even trying a different version of Katalon specifically 8.3.0. The reply contains my findings after doing all that.

Right now I can only know it keeps waiting for a process, until further research, and any additional information/documentation on how “Default Smart Wait” works and what it tracks might help me to narrow the options to troubleshoot.

@albert.vu @vu.tran Can you get some devs to look at this?

1 Like

Let me tell you my view.

Have a look at an old Q&A about “what Smart Wait actually / internally does”:

@ThanhTo wrote there “Internally, the Smart Wait funcitionality waits for the page to become static within some timeframe”. How the Smart Wait can know if the page has become static?


You can find the source code set of Katalon Studio v8.0.5 at https://github.com/katalon-studio/katalon-studio-testing-framework/blob/master/Include/scripts/groovy/ . You can search for the string “SmartWait” in the set of source codes. There I found nealy 30 hits. Especially the following class is interesting:

I read this, and guess …

When the Smart Wait is enabled, Katalon starts an instance of com.kms.katalon.core.webui.driver.SmartWaitWebDriver which wraps the native org.openqa.selenium.WebDriver. The SmartWaitWebDriver starts a web browser and navigate to a web page; then it injects a small piece of JavaScript like this:

    var callback = arguments[arguments.length - 1].bind(this);
    window.katalonWaiter.katalon_smart_waiter_do_ajax_wait(callback);

and

    var callback = arguments[arguments.length - 1].bind(this);
    window.katalonWaiter.katalon_smart_waiter_do_dom_wait(callback);

These JavaScript code affects to the window object of JavaScript in browser, and let the window to notify the SmartWait object of all of AJAX events and DOM Tree modification events. Effectively Katalon’s SmartWait object will be notified of all AJAX events and DOM Tree modification events in browsers. Provided with this mechanism, the Smart Wait in Katalon can listen to the flow of AJAX events and DOM Tree modification events in the remote browser.

What is AJAX? — See Ajax (programming) - Wikipedia

Provided with the AJAX Event stream is branched and connected, the SmartWait in Katalon Studio can know if the target page is (possibly) still moving somehow/somewhere, or has become static. That is what @ThanhTo told us.

1 Like

@david.avalos

Perhaps, your AUT (Application Under Test, the web page which you are to test) uses AJAX technology internally. While an AJAX event stream continues flowing, the Smart Wait is tricked and wait long until the maximum timeout expires.

Your AUT could have a long-sustained AJAX event stream. For example, a web page may have a single line where a news ticker continuously updated driven by AJAX. In that case, the Smart Wait is likely to repeat expiring the maxmum timeout (default 30 seconds).

When an AJAX event stream ceased somehow, the Smart Wait of Katalon will suddenly stop waiting long.

Nobody, other than you, knows if your AUT has an ever-flowing AJAX event stream internally. Only you can investigate it. Therefore you should not ask any assistance to others in this forum (including Katalon) for further research about your AUT itself.

You can not visually see the AJAX event stream; so you are likely to get puzzled when the Smart Wait suddenly changes its behavior. In my humble opinion, you would never be able to use the Smart Wait with confidence if you are not well aware how your AUT is designed internally. And I believe that many of the Web UI testers in the industry are not trained enough; they don’t really know how their targets are working. Therefore the Smart Wait tends to confuse them.

1 Like

I guess, when Katalon released the Smart Wait at v7.x in 2019, they hoped the Smart Wait feature will automagically help beginners of automated Web UI testing. But in fact, ironically enough, the Smart Wait tends to trap them into a labyrinth. What’s AJAX? what’s DOM? what’s Event Stream? — The beginners possibly don’t know these terms. But without understading these terms, they would not see the reason why the Smart Wait suggenly changed its behavior.

It seems that Katalon team was reluctant to publish any detailed documentation how Smart Wait works. If they are to write it, they must start with a lengthy explanation what AJAX is, what DOM is … I suppose that they didn’t like to bother themselves with authoring such documents. I am with them; even if published, Katalon users would not like to read such technically-highbrow docs.

I think, the Smart Wait is an unfortunate mistake. It will never be well accepted by users. At least, I will never use it. Katalon should deprecate the feature in order to avoid the annoyances for new comers in future.

1 Like

Hi folks, :wave:

I have forwarded this thread to our product team and hopefully, we would get some more information from them soon. Thanks for your patience!

@Russ_Thomas @kazurayam Thanks for the help!

You can read the source code of JavaScript that implements the “Smart Wait” feature. As @Russ_Thomas pointed out

Go to <katalon-install>\configuration\resources\extensions\Chrome\Smart Wait\content\wait.js

If you read the wait.js, then you would understand what the “Smart Wait” does. It waits for every AJAX Event stream in the page to cease so that the HTML DOM gets stable. Once you enable “Smart Wait”, calls to WebUI.* keywords will be wrapped by the “Smart Wait” so that it is likely that the every calls to WebUI.click() keyword to take the full “Default wait timeout”. If you want to avoid it, the only solution is to disable Smart Wait.

In the late 2023, the Smart Wait is still confusing users.

Today I would suggest a solution to those who got confused by Smart Wait,

  1. Still you should choose the settings Default Smart Wait to be Disabled
  2. When necessary, you can toggle it ON programatically by a custom Keyword that I suggested at
    Katalon suite taking 30 seconds between steps and I can't figure out why - #36 by kazurayam
  3. Once you finished utilizing the Smart Wait, you should not forget to toggle it OFF programatically.