WaitForElement - Don't wait

I am also facing the same problem as in this topic WaitForElement - does not work as required

I don’t understand why the wait function doesn’t wait according to the timeout set in the function(10 seconds). The wait function seems to just wait 1 second and then finish
I’m sure my path in findTestObject(…) is correct. Because I tried waiting in case the object already exists and the wait function found it.
If the object already exists and the wait function only works, then this function has no meaning anymore

Anyone who had the same problem as me and had a solution, let me know
Please!!!

Please create a sample Test Case that is runnable on other’s machine. The sample should reproduce your findings. Without a runnable sample code, it is difficulut to discuss productively.

2 Likes

After much testing, I noticed that this problem appears on Hybrid applications.
Specifically, on page Login (with format web_app), you create a wait() function to wait for an object to exist on page Home (with native_app format). When page Home starts to load, the wait() function immediately stops and returns no object found even though there is still some time to wait.
The wait() function must wait for the “timeout” that I have set up. But no, the wait is not done yet, the wait() function to return a result that is not found
With sample code, it’s just Katalon’s “Wait for Element Present” function

@thanh.tung.170861

Which version of Katalon Studio do you use?

Prior to v8.6.5 (possibly sinice v8.6.0) , WebUI.waitForElementPresent had a problem; it doesn’t wait at all.

As the relase note v8.6.5 says, the problem should have been fixed at v8.6.5.

Why not you try it?

I tried with version 8.6.6, this problem still exists
The waitForElementNotPresent function still ends before the timeout expires
I set the timeout to 60 seconds, the wait function ends after 11 seconds(the same time when the application switches to a new page).
→ And of course the returned result is: Element ‘Object Repository/.etc.’ is present

Could you please use the other strategies. It is possible that the element is simply being hidden from the view but not actually being removed from the DOM

  1. waitForElementVisible
  2. waitForElementClickable

Let me know if it works for you

??? I think that the keyword is working as specified. Why do you think “the problem still exists” ?

The waitForElementNotPresent keyword will end as soon as the target element disappers. When the application switches to a new page after 11 seconds, the target element disappers. So the keyword will end. The keyword will wait until the timeout expires only when the target element remains present.

I am afraid that you misunderstood what the keyword does. The name “…NotPresent” might have confused you. The “waitForElementNotPresent” should rather be known as “waitForElementToDisappear”.