Hello everyone,
I have a problem with the “Verify Element Present” feature. It immediately returns me if the object is present, but if the object is not present it is not so reactive in giving a response, it can also take 10 seconds or more. Same problem with “Verify Element Not Present”. There is a solution?
It waits for up to as long as you specify. If the object is present after only 4
seconds, the test step completes and the test moves on.
In this example, wait up to 20
seconds:
WebUI.verifyElementPresent(myTestObject, 20)
Hi Thomas,
I’m sorry I didn’t specify that I get this delay even if I set the seconds to 0. It’s like ignoring the timeout I enter. Is it possible that it is a Katalon setting?
Do this:
- Post your OS version and your Katalon version.
- Post your code.
- Post the relevant lines form the Console panel (so I can see the timings).
I doubt there is a bug in Katalon APIs – there would be ten thousand people complaining about it.
Here are the project timeouts:
I can confirm that the timeout that the “Verify Element Present / Not Present” function wait is 30 seconds (the one present in the settings as in your screenshot) even if I set 0.
Windows 10, Katalon Studio 6.3.3
Code:
if (WebUI.verifyElementNotPresent (findTestObject (‘Object Repository / Page_iPlus Test Shop / input_Pagamento_contract_3’),
0, FailureHandling.OPTIONAL) == false) {
WebUI.click (findTestObject (‘Object Repository / Page_iPlus Test Shop / input_Pagamento_contract_3’))
}
In this case the object "‘Object Repository / Page_iPlus Test Shop / input_Pagamento_contract_3’ is present on the page.
What am I doing wrong?
In addition to what @HeleneB said…
If you wait for an element to be not not present and the element is present it will take exactly as long as you specify. This will all happen before the boolean result false
is checked.
Caveat emptor: There are too many nots and falses here. Not sure why you feel the need to code a test that way. It’s confusing the hell out of me.
Thanks Helene
I’m confused too (they were only tests, now I take off the not) Thanks for the support
just do a simple !confused and you may be enlightened … or not
now seriously, the not is always tricky when detecting elements. to be sure it is not present, you have to wait for a certain time so the dom is fully parsed and the page rendered by the browser. otherwise … you can simply not check it at all, if the page is not rendered the element is not present. so first you have to check what is the maximum time for the element to be present before to negate the condition and once you have a certain safe timeout, do the fine tunning
a better aproach will be to find an element which is always rendered last, wait for it,no matter if the subject for test may apear or not. once that element is there,you can assume the page is rendered and check for the presence of the element in the scope of testing.