Hi Experts, need advice
This is my scenario β I run a process/job and it takes, for e.g., 10min. to complete
Hence, I had given WebUI.delay(600)
And process/job is running in the background
Now, during this 10min. wait, if the application [AUT] remains idle say for 5min., then at 6th min., a pop-up is thrown, asking to extend the idle time or else system will automatically log-off in the next 2min.
Can anyone let me know how to handle this kind of pop-ups ?
Many Thanks
2 Likes
Step 1: Create a Custom Keyword (e.g., PopupHandler.groovy)
Create this under
Keywords > utils > PopupHandler.groovy
package utils
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.util.KeywordUtil
class PopupHandler {
/**
* Continuously checks for a pop-up every few seconds
* and dismisses it if found.
* Runs in a separate thread.
*/
static void monitorPopups(int intervalSeconds = 10) {
Thread.start {
while (true) {
try {
if (WebUI.waitForAlert(intervalSeconds)) {
KeywordUtil.logInfo("Pop-up detected! Accepting alert...")
WebUI.acceptAlert()
}
} catch (Exception e) {
// Ignore if no alert appears
}
// Small delay before checking again
Thread.sleep(intervalSeconds * 1000)
}
}
}
}
Step 2: Call It at the Start of Your Test Case
import utils.PopupHandler
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
// Start monitoring in background
PopupHandler.monitorPopups(10)
// Start your main long-running process
WebUI.openBrowser('')
WebUI.navigateToUrl('https://your-webapp-url')
// Example: waiting or running background process
WebUI.delay(600) // simulate 10-minute process
WebUI.closeBrowser()
1 Like
Hope itβs only for one off test case.. not for all scenario
1 Like