This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-smartwait.html
This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-smartwait.html
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?
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.
how do you measure the staticness of the page?
It’s multiple complex trial, error and fallback. There’s currently no standard way to measure such a thing.
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?
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.
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.
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?
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.
@ThanhTo just my two cents … maybe smart wait has to be offered in disabled state by default?
it looks like is creating some confusions …
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()
)
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.
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.
which, in certain scenarios, can last forever …
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
.
And that’s the part I just messaged you about. Me no like blackboxes.
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
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 ?