Popup should appear for 30 Seconds. how to measure that?

Hello Katalon community!

As mentioned in the title, I need to verify that a popup message will be displayed for exactly 30 seconds
Have you an idea on how to automate this?

Many thanks


it should not be a problem. You can use a combination of waitForElementVisible and waitForElementNotVisible. As soon as element is visible, get a start time and wait for element not visible. Then, get end time and calculate diff.

Thanks a lot Marek for you replay.
As I’m new in Katalon and automation in general, could you just give me an example of what the code line should look like?
Thank you in advance :slight_smile:

Try this:

WebUI.waitForElementPresent(testObject, 10, FailureHandling.STOP_ON_FAILURE)
long startTime = System.currentTimeMillis()

WebUI.waitForElementNotPresent(testObject, 60, FailureHandling.STOP_ON_FAILURE)
long endTime = System.currentTimeMillis()

int totalTimeSec = (endTime - startTime) / 1000

if(totalTimeSec < 29 || totalTimeSec > 31) {
	KeywordUtil.markFailed("The element was not present for 30 seconds, but for " + totalTimeSec + " seconds")

Note: It is really hard to determine 30 seconds sharp due to WebDriver’s limitations, so please allow the acceptable interval between 29 to 31 seconds


I really don’t know how to thank you!
I will try this this night … (can’t wait to check the results!)
Many thanks Marek :slight_smile:

Welcome, let me know then if you need further assistance. :wink:

Your solution works perfectly Marek! thank you a lot for your help … I really appreciate :slight_smile: