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.
Most web applications today are developed using front-end technologies such as Javascript or Ajax. With these techniques, after the web page is loaded by the browser, elements on that page might be ready for interacting at unpredictable time intervals.
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.
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).
This new feature of Katalon Studio cures the pain points mentioned above.
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.
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.
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.
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.
In Katalon Studio, go to:
On the right sidebar, under Default Smart Wait, select Enable
To use the Smart Wait function for certain test elements, it’s important that you disable Default Smart Wait in Project Settings:
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.