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.
Wait For Exists.
Re: Wait For Exists.
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
-
- Posts: 56
- Joined: Thu Oct 29, 2020 12:47 am
Re: Wait For Exists.
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.
Re: Wait For Exists.
Also check to make sure that repository caching is turned off for the elements. Right click repo element, Properties --> Use cache = False