Wait For Exists.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Posts: 31
Joined: Fri Jul 02, 2021 2:35 pm

Wait For Exists.

Post by QATest879 » Tue Oct 05, 2021 4:15 pm

So I'm using the waitforexists method and it's still having trouble finding the element for some reason.

Here is the situation:
1. The application being tested starts closed, it's not running.
2. Ranorex starts the application, it runs it.
3. Then I want to wait until the application is loaded before I start the test.

I do this: repo.application.elementInfo.WaitForExists(30000);

And I was expecting this to work, I simply wait for an element on the application to load and then that's how I know if the application has loaded. But it waits for 30 seconds and then tells me it couldn't find the element, and even attaches a screenshot of my display, which includes a window of the application with the element on it clearly visible.

The reason I think it doesn't work is because the application isn't loaded when the test starts... I'm not sure if that's why... the application has a loading screen first and then it goes to the main scree, does anybody know if there's a way to detect when an application has reached the main menu screen in this scenario? This issue might be somewhat hard to solve I think.

Thank you. :mrgreen:

User avatar
Certified Professional
Certified Professional
Posts: 78
Joined: Mon Dec 07, 2020 6:30 pm

Re: Wait For Exists.

Post by tmcdoniel » Tue Oct 05, 2021 4:29 pm

In the example below, I'm waiting up to 20 seconds for FirstName field to become available indicating that the application has loaded. There might be some other element that you might need to tie it to that indicates that the application is fully loaded before proceeding. Also, depending on how slowly application loads you might have to adjust the waitfor time.
Sales Engineer @ Ranorex

User avatar
Posts: 56
Joined: Thu Oct 29, 2020 12:47 am

Re: Wait For Exists.

Post by tiffin.filion » Tue Oct 05, 2021 5:36 pm

QATest879 wrote:
Tue Oct 05, 2021 4:15 pm
So I'm using the waitforexists method and it's still having trouble finding the element for some reason.
I had that same issue for the longest time. My tests were failing because what I was testing hadn't loaded completely yet. Have you tried WaitForDocumentLoaded()? It's only available on your base Application Under Test item in the repository. That has saved us a TON of headaches.

-- Tiffin --
Senior QA Analyst

Posts: 71
Joined: Thu Feb 27, 2014 7:33 pm

Re: Wait For Exists.

Post by dhale » Tue Oct 05, 2021 6:05 pm

Also check to make sure that repository caching is turned off for the elements. Right click repo element, Properties --> Use cache = False