Page 1 of 1

Wait Until 'Object' Exists Problem

Posted: Wed Mar 31, 2010 9:18 am
by costamesakid
I have a script that launches an application as its 1st step. A splash screen is displayed until the application loads. The next step is User Code which which ensures a Windows Explorer dialog exists and then loads a map if it exists, and if it a map does not exists it 'clicks' cancel.

The problem is that splash screen takes anywhere from 8-20 seconds to load depending on the system and the User Code executes often executes before the application/map dialog is even displayed.

I tried this:

public static void MapDialogue()
{
Report.Info("Validating Exists on item 'FormOpen.ListItemPacificWorldMap'.");
while (repo.FormOpen.ButtonOpen1Info.Exists())
{
if (repo.FormOpen.ListItemMapInfo.Exists())
{
repo.FormOpen.ListItemMap.DoubleClick("center");
}
else
{
repo.FormOpen.ButtonCancel.Click("center");
}
}
}

I just dont want that code to execute until the splash screen closes and the dialog box 'exists'. and of course i have to avoid delays as I said the splash screen load is dependent upon the users system. Thanks!

Re: Wait Until 'Object' Exists Problem

Posted: Wed Mar 31, 2010 3:58 pm
by Ciege
Can Spy get the proper xPath of the splash screen? You can do a find on the splash screen as your first step then a wait until the splash screen is no longer visible.

Or you can get an xPath from an object in the AUT that does not appear until the splash screen is gone or maybe does not become enabled until the splash screen is gone. Then you can do a wait for that object to become visible or enabled.

Re: Wait Until 'Object' Exists Problem

Posted: Tue Apr 06, 2010 10:53 pm
by costamesakid
I ended up just doing a ValidateExists on the Form that loads after the splashscreen exits and set the timeout to that from object to 20s. As soon as the form loaded, Ranorex would validate it and then start executing my user code