How can I use timeout less the 1 second in builtinKeywords

Hi, I just wanted to use timeout less than 1 second in builtinKeyword how can I achieve that
for eg: Mobile.verifyElementVisible(testobject, 0.1, failureHandling)
Currently only minimum timeout I can give is 1 second so if anyone know how to achieve please let me know

Thanks,

1 Like

No, you can not. As clearly documented, the minum timeout value of Katalon’s built-in keywords is 1 second.

I do not see why you want to use timeout faster than 1 second. In my opinion, it is not a good idea to expect your web application to work with preciseness of milli-seconds.

1 Like

Just a note that the timeout is not the amount of time that the statement will take, but the time the system will wait for the element to become visible before giving you an error. If the statement finds your object right away (like in 0.1 seconds), it will return true and move on to the next statement. Realize that computers do other things, like check if you have email, beside running your code all the time. I like 10, but you can set it for 3.

System will wait at most timeout (seconds) to return a result

4 Likes

ok I got it thanks I required for some condition so is there any other method I can use similar to mobile.verifyelementvisible with full control of timeout @grylion54 and @kazurayam

1 Like

It would be possible for you to create a custom keyword which works almost the same as Mobile.verifyElementVisible but accepts the timeout in milli-second order.

You can read the full Groovy source code of the Mobile.verifyElementVisible at

At the LINE#72, you see

            WebElement element = findElement(to, timeout * 1000)

This line is the very reason why the timeout value is treated as seconds-basis, not milli-seconds-basis.

You can create your custom keyword with new package name and class name. You want to copy the source the Mobil.verifyElementVisible into it. Then change the LINE#72 to

            WebElement element = findElement(to, timeout)

Then your custom keyword would work on milli-seconds basis.

1 Like

Thank you very much @kazurayam will check this and let you know the results

1 Like

Can i write WebUI.delay in milliseconds? i found that it can only be second

You can not change the WebUI.delay keyword.


You can read the source of the WebUI.delay keword at

You would find the following statement:

                Thread.sleep(second * 1000)

You can “study” it and create your own keyword as a mimic of the Katalon’s built-in keyword. You can make it as you like.

However I don’t think it would be worth trying to control the delay in milliseconds. The Thead.sleep() would work just accidentally, would not very precise. You can not be very sure how long the delay will actually be. So I think WebUI.delay(1) second is enough for my testing purpose.

1 Like

Use sleep()

That method takes an integer amount of milliseconds

You do know that the “delay” can take a number. That means the value does not have to be an integer. So why not just put in a decimal, like:
WebUI.delay(0.005)
or
WebUI.delay(0.5)

And instead of WebUI.delay(), you can always try WebUI.waitForElementVisible(..., 10) and since your element is already visible, the statement will run likity-split, like in 0.17 seconds, like the Road Runner (Neep-Neep). Personally, while my tests are running I’m not bothered by 1 second. Sit back, relax and sip your tea.

Interesting idea.

I tried the following Test Case:

import java.time.LocalDateTime

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

println LocalDateTime.now()
WebUI.delay(0.01)
println LocalDateTime.now()

When I ran it, I got the following output:

2023-12-06 17:16:07.728 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2023-12-06 17:16:07.730 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/delay0.1
2023-12-06T17:16:07.828215
2023-12-06T17:16:07.882897
2023-12-06 17:16:07.895 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/delay0.1

0.882897 - 0.828215 makes 0.054682 second of time gap.

I specifed the wait for 0.01 second, but actually the test delayed for 0.54 seconds. The Thread.wait can not be precise verify much. I think it is acceptable. I don’t need the preciseness under 1 second.

That really does call the question the need to even wait for less than a second… I could understand it in keywords, for example custom waits (e.g. polling browser URL every half a second), but for the life of me I cannot understand it in actual test case…