# \[WebUI\] Smart Wait Function

**URL:** <https://forum.katalon.com/t/webui-smart-wait-function/32816>\
**Category:** Miscellaneous\
**Tags:** new-doc-request\
**Created:** [September 10, 2019, 4:21am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816 "2019-09-10T04:21:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/katalon/original/3X/d/5/d55596ab02785a255798e87ede769734747b30c4.svg) [@system](https://forum.katalon.com/u/system)\
**Post date:** [September 10, 2019, 4:21am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/1 "2019-09-10T04:21:21Z")

</div>

* * *
This is a companion discussion topic for the original entry at [https://docs.katalon.com/katalon-studio/docs/webui-smartwait.html](https://docs.katalon.com/katalon-studio/docs/webui-smartwait.html)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [October 1, 2019, 9:35pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/2 "2019-10-01T21:35:28Z")

</div>

Why enabling/disabling Smart Wait function is there? What does it mean? How is the Smart Wait function is different from waitForPageLoad() keyword?

Could you describe a bit of internal of the Smart Wait function?

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 2, 2019, 6:02am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/3 "2019-10-02T06:02:04Z")

</div>

Hi @kazurayam

The setting in Project \> Setting \> Execution for Smart Wait will take effect for all test cases. While if you disable the global setting, and use the smart wait enable/disable keywords in your test case, then only the section of code between these two keywords will be affected by the smart wait functionality.

Internally, the Smart Wait functionality waits for the page to become static within some timeframe, so that the phenomenon where elements are not present, or some loading overlay prevents clicks/actions to reach the desired element would present less.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [October 2, 2019, 6:24am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/4 "2019-10-02T06:24:58Z")

</div>

> [@ThanhTo](#):
>
> the page to become static within some timeframe

how do you measure the staticness of the page?

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 2, 2019, 6:36am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/5 "2019-10-02T06:36:11Z")

</div>

It’s multiple complex trial, error and fallback. There’s currently no standard way to measure such a thing.

---

<div class="post-metadata">

**Author:** ![JOE\_F](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@JOE\_F](https://forum.katalon.com/u/JOE_F)\
**Post date:** [October 23, 2019, 8:12pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/6 "2019-10-23T20:12:28Z")

</div>

what’s the difference with using  
WebUI.enableSmartWait()  
and using  
WebUI.waitForElementVisible()  
WebUI.waitForElementClickable()

does that mean if enableSmartWait, we don’t need to waitForElement any more?  
can you control how long to do SmartWait?

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [October 23, 2019, 8:27pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/7 "2019-10-23T20:27:16Z")

</div>

> [@JOE\_F](#):
>
> does that mean if enableSmartWait, we don’t need to waitForElement any more?

Not exactly, no. But in some circumstances, maybe. It’s a different approach, designed to alleviate a known issue with “static” waits.

If you have questions, you really should read the article in the link.

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 24, 2019, 2:50am UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/8 "2019-10-24T02:50:44Z")

</div>

@JOE_F

It really depends, if the page is not too dynamic (in the sense elements are not being loaded) but there’s a javascript callback that would make your element clickable some times later after the page load, then you would still need to use `WebUI.waitForElementClickable` as Smart Wait will not wait for that specific condition to be true.

This Smart Wait Function serves to alleviate the problems relating to waiting issues of Selenium such as actions get operated when the page is not (relatively) static yet.

---

<div class="post-metadata">

**Author:** ![joanna.moylan](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@joanna.moylan](https://forum.katalon.com/u/joanna.moylan)\
**Post date:** [October 29, 2019, 3:38pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/9 "2019-10-29T15:38:54Z")

</div>

What’s strange is that before the update, I had a test case that required a waitForElementClickable() for one element but not a second (this one’s inside a modal if it makes a difference). Since the update it’s now the other way around. I have to disable smart wait for my test to run again. Anyone any ideas why this is?

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 29, 2019, 3:44pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/10 "2019-10-29T15:44:21Z")

</div>

It’s hard to say without the precise description. Smart Wait is there so that users who are unfamiliar with Selenium and programming in general can free themselves of some of the most common problems like elements not clickable, etc.

But well, it’s not a silver bullet, I think elements in a modal fall outside of normal use cases, which can explain why Smart Wait is not resolving this particular problem.

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [October 29, 2019, 4:01pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/11 "2019-10-29T16:01:13Z")

</div>

@ThanhTo just my two cents … maybe smart wait has to be offered in disabled state by default?  
it looks like is creating some confusions …

---

<div class="post-metadata">

**Author:** ![joanna.moylan](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@joanna.moylan](https://forum.katalon.com/u/joanna.moylan)\
**Post date:** [October 29, 2019, 4:07pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/12 "2019-10-29T16:07:28Z")

</div>

I changed my selector and that seemed to help. My only guess is that the original selector wasn’t _technically_ clickable since that’s the error Smart Wait seemed to be giving me. I guess my next question would be if Smart Wait chooses a wait function based on the type of action to be performed on an element? (e.g. Smart Wait will use `waitForElementClickable()` before a `WebUI.click()`)

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 29, 2019, 4:23pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/13 "2019-10-29T16:23:02Z")

</div>

Hi @joanna.moylan

In the latest version, the Click Keyword already waits for the element to become clickable before initiating the click. Smart Wait is different from selecting an appropriate wait function, it’s essentially a complex trial and error mechanism that aims to ensure that the page is relatively static.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [October 29, 2019, 4:43pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/14 "2019-10-29T16:43:17Z")

</div>

> [@ThanhTo](#):
>
> Smart Wait is […] essentially a complex trial and error mechanism that aims to ensure that **the page is relatively static**.

If I understand correctly, that’s the key point. It doesn’t care so much about _individual elements_, it’s more about _ **waiting for the page to finish all conversations with the server** _.

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [October 29, 2019, 4:52pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/15 "2019-10-29T16:52:20Z")

</div>

> [@Russ\_Thomas](#):
>
> _ **waiting for the page to finish all conversations with the server** _ .

which, in certain scenarios, can last forever …

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [October 29, 2019, 5:02pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/16 "2019-10-29T17:02:19Z")

</div>

@Ibus @Russ_Thomas

Well that’s why Smart Wait also comes in the form of Built-in Keywords. You can choose to have Smart Wait only at specific parts in your tests by using `WebUI.enableSmartWait` and `WebUI.disableSmartWait`.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [October 29, 2019, 5:05pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/17 "2019-10-29T17:05:08Z")

</div>

And that’s the part I just messaged you about. Me no like blackboxes. 😕

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [October 29, 2019, 5:41pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/18 "2019-10-29T17:41:21Z")

</div>

@ThanhTo human beings are we … sometime AI may fail … mhm mhm …

---

<div class="post-metadata">

**Author:** ![sshejwal](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@sshejwal](https://forum.katalon.com/u/sshejwal)\
**Post date:** [November 5, 2019, 12:36pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/19 "2019-11-05T12:36:42Z")

</div>

i have updated Katalon to latest version 7.0.6  
now i am getting error with Chrome while executing my previous test cases .  
**Error Loading Extension**

 ![Katalon_issue](https://europe1.discourse-cdn.com/katalon/original/2X/8/81a96998eb1fe20723b1679f4f1d7a2dfb6a8769.png)

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [November 5, 2019, 1:17pm UTC](https://forum.katalon.com/t/webui-smart-wait-function/32816/20 "2019-11-05T13:17:16Z")

</div>

Hi @sshejwal

I cannot reproduce this on my side. Please send us the log under `Help > Error Log` when this issue happens. Also I notice in the picture you post the path references a 6.3.1 version of Katalon Studio, are you certain that you’re using the latest version ?

[Next page](https://forum.katalon.com/t/webui-smart-wait-function/32816.md?page=2)
