Question concering the timeout wait in the waitForElementVisible

So I have a question concerning the working of the waitForElementVisible.

2023-04-19 08:33:16.260 DEBUG testcase.testControleerAdres             - 4: click(findTestObject("Klant/Page_Klant/button_geavanceerd"))
2023-04-19 08:33:16.348 DEBUG testcase.testControleerAdres             - 5: waitForElementVisible(findTestObject("Klant/Page_AdressenBeheren/dropdown_weergeven"), 20)

I press a button, the Klant/Page_Klant/button_geavanceerd button.
After that, a new page should open and it should load and on that page a dropdown should be visible.
So I do a waitForElementVisible with a timeout of 20 seconds.
Per my understanding it means I am giving the page a maximum of 20 to load or the step will fail.
Then this:

023-04-19 08:33:17.385 INFO  c.k.k.c.webui.common.WebUiCommonHelper   - Unable to find the element located by 'By.cssSelector: [id^=LogisticsPostalAddress][id$=ViewOption_input]'. Please recheck the objects properties to make sure the desired element is located. 
2023-04-19 08:33:17.385 WARN  c.k.k.c.webui.common.WebUiCommonHelper   - [SELF-HEALING] Failed to find element with id 'Object Repository/Klant/Page_AdressenBeheren/dropdown_weergeven'. Try using Self-healing.
2023-04-19 08:33:17.387 WARN  c.k.k.c.webui.common.WebUiCommonHelper   - [SELF-HEALING] Cannot find elements when the XPath is null.
2023-04-19 08:33:18.392 INFO  c.k.k.c.webui.common.WebUiCommonHelper   - Unable to find the element located by 'By.xpath: '. Please recheck the objects properties to make sure the desired element is located. 
2023-04-19 08:33:18.392 WARN  k.k.c.w.k.b.WaitForElementVisibleKeyword - Web element with id: 'Object Repository/Klant/Page_AdressenBeheren/dropdown_weergeven' located by '[id^=LogisticsPostalAddress][id$=ViewOption_input]' not found
2023-04-19 08:33:18.393 DEBUG testcase.testControleerAdres             - 6: click(findTestObject("Klant/Page_AdressenBeheren/dropdown_weergeven"))
<<More stuff fails>>
2023-04-19 08:33:22.988 DEBUG testcase.testControleerAdres             - 8: setText(findTestObject("Klant/Page_AdressenBeheren/dropdown_weergeven"), "Historie")
2023-04-19 08:33:23.143 DEBUG testcase.testControleerAdres             - 9: sendKeys(findTestObject("Klant/Page_AdressenBeheren/dropdown_weergeven"), Keys.chord(ENTER))

2023-04-19 08:33:16.260 I click the button
2023-04-19 08:33:16.348 The wait starts
2023-04-19 08:33:18.392 After self healing fails the step just gives up.
2023-04-19 08:33:18.393 The test continues to the next step.


That is 2 seconds after the wait starts.
That seems a little too soon to me.
I would expect perhaps several retries in a span of max 20 seconds.
at 2023-04-19 08:33:22.988 a future step interacting with the same object does pass.
The rest of the test just passes fine.

2023-04-19 08:33:16.348 The wait starts
<<Several failures interacting with the object>>
2023-04-19 08:33:22.988 A step passes

That is about 6 1/2 seconds later

So either in the 2 seconds of the waiting step the element became briefly visible and the step said, right I saw it, I am done waiting.
Or something else is happening that I do not understand.

Can you, the community, help me understand what I might change?

you can check default wait time.

Project ->Setting ->Execution


Thanks,
Aman

@matthijs.risselada

I do not see what you want to achieve.

I’d suggest to run this in a small test suite so that you have a screenshot on failure. You may well see that a page is still loading or some other transition. Depending on how dynamic your page is, you might find that some combination of a hardcoded delay plus your ‘wait for element’ keyword is required.

Thank you for your reply.
I was under the impression that these default values were in case you did a wait without specifying the time period.
My project settings are exactly the same as the one shown in your screenshot, except I use Edge Chromium in stead of Chrome.

Hi Kazurayam,

Sorry to be unclear.
I was wondering what I should change so that the page would wait for the element to be fully visible before continuing and interacting with the element.

Hi Dan_Brown,

Thank you for replying.
I should have the take a screenshot option enabled.
A combination of explicit and implicit waits are probably going to be the solution, thank you for suggesting this.
I will, isolate this step and run the test several times to see if I can discern some pattern.
Perhaps also a different wait might be required. Wait For Element Clickable, since next action would be a click.
image