Table of Contents
Katalon Smart Wait: A New Way to Handle Web Loading Issues
For those who are familiar with Selenium WebDriver, one of the most common features is the Wait command. These commands are handy in test scripts execution, or observing and troubleshooting issues that arise due to time lag.
Wait commands are powerful — but they also come along with a big problem with timing due to front-end processing. Starting from version 7.0.0, we have introduced the Smart Wait feature that helps you handle Selenium wait issues without any additional test scripts.
The #1 Selenium’s Villain: Timing Issue
This is not an issue to manual testing, but a huge problem to automated testing since no one is there to tell the machine when it should take actions. As a result, you may easily encounter these exceptions while using Selenium: NoSuchElementException, StaleElementReferenceException, or ElementNotVisibleException.
There are several solutions to problems in Selenium wait — but they don’t seem to go directly to the point. They were more about mitigating or avoiding the problem than really tackling it. Among these solutions, The Implicit and Explicit wait commands are the most popular solutions.
However, these solutions come with risks and uncertainties.
- Implicit wait
The implicit wait in Selenium tells the WebDriver to wait for a certain amount of time before sending the NoSuchElementException exception. This approach is risky since the execution time heavily depends on many external factors. Moreover, there’s no magic formula for the wait time – it’s a case-by-case number. Waiting too long leads to waste, while being too short leads to more likelihood of failure.
- Explicit wait
The explicit wait in Selenium tells the WebDriver to wait for certain conditions or the maximum time exceeded before throwing an ElementNotVisibleException exception.
This is an intelligent solution as it will wait for dynamically loaded elements. However, it can be only applied for specified elements. Moreover, it will not work in cases where the element is visible but not interactable.
But even if these two solutions work, it requires expertise and manual insertion of wait statements. Furthermore, misunderstanding or not following the best practices of applying implicit and explicit waits could bring up even more problems.
Thus, the solution itself becomes a new timing issue. It leads to many pain points that any automation project may suffer — not only during the test execution phase but also the test design and results analyzing phases: test creation takes more time, code gets worse, execution output becomes unstable, debugging and test maintenance becomes more difficult.
This will eventually lead to poor team performance, costly maintenance expenses and efforts, and low-quality application under test (AUT).
Katalon Smart Wait Saves the Day
This new feature of Katalon Studio cures the pain points mentioned above.
Automatically wait for front-end processes
Katalon Smart Wait will automatically wait for all front end processes of the web page to complete before taking the next steps; thus completely prevent unstable outputs from happening.
What this means is that all execution results will be consistent. This will save automation engineers a vast amount of time investigating false alarms. Moreover, it would be easier and faster to identify the root causes of issues in case of real failure.
Faster execution speed
Smart Wait can also improve the test execution speed by keeping the results stable — especially in overnight-batch execution, where unexpected failures can stop the whole process, and no one is available to re-run.
Better analytics and insights
It also keeps the execution history clean and clear for analytics to detect operation insights or patterns. Eventually, team performance will be improved, and better data-driven decisions will be delivered.
As a result…
Because timing control codes are no longer needed, the test creation speed would be significantly improved. Teams will have more bandwidth to focus on testing scenarios and improving test scripts quality.
Moreover, Smart Wait will help reduce the maintenance cost and effort while dealing with the timing codes. Developing and deploying test scripts now becomes less troublesome, even in a highly scalable environment.
How to Use Katalon Smart Wait
First, make sure you’ve installed Katalon Studio version 7. Download here
There are two ways to apply Smart Wait: to all elements of a project, or to a specific element of a test script.
Apply Smart Wait to all elements of a project
In Katalon Studio, go to:
- Projects > Settings
- On the left sidebar, select Execution
On the right sidebar, under Default Smart Wait, select Enable
Apply Smart Wait to a specific element of a script
To use the Smart Wait function for certain test elements, it’s important that you disable Default Smart Wait in Project Settings:
- Go to Projects > Settings
- On the left sidebar, select Execution
- On the right sidebar, under Default Smart Wait, select Disable
Use the keywords enableSmartWait and disableSmartWait keywords to enable and disable this function, respectively.
For more details, refer to Katalon document.
To see how Smart Wait works, see Sample Smart Wait project.
Smart Wait is one of our most unique features in the major upgrade of Katalon Studio 7. This feature is a breakthrough solution for Selenium wait issues. It also saves substantial time implementing the waiting script and reducing failed test cases due to the element loading reasons — with no coding required. Plus, this innovation and more to come will help ensure a sustained quality control solution for all automation engineers and teams.
Please fill out the form and we'll be in touch soon.