public static Ranorex.Form WaitForWindow(string WindowName, int Timeout)
{
/************************************************************************
* Function : WaitForWindow(string WindowName, int Timeout)
*
* Description : This function will wait for a window with a specific
* : Title or ControlName to appear.
*
* Parameters : WindowName - Title or Control Name of the window to wait for
* : Timeout - Time (in seconds) to wait for the window
* - before giving up.
*
* Return Type : Ranorex.Form
*
* Return Value : Ranorex.Form Object for success, null for failure
*
* Revision History
* Date : Author : Reason/Change
* ---------- : ------------------------- : ------------------------------
* 03/05/2009 : Chris Gendreau : Initial Creation
* 05/04/2009 : Chris Gendreau : Rewritten to use simpler FindSingle method
* 10/27/2009 : Chris Gendreau : Added functionality to check for controlname also
************************************************************************/
Ranorex.Form HDForm = null;
Report.Debug("Waiting for window: " + WindowName);
try
{
HDForm = Host.Local.FindSingle("/form[@title='" + WindowName + "' or @controlname='" + WindowName + "']", Timeout * 1000);
HDForm.Activate();
Thread.Sleep(1000);
return HDForm;
}
catch (RanorexException e)
{
Report.Debug("Unable to find window: " + WindowName);
return null;
}
} //End WaitForWindowexists, dialog = Host.Local.TryFindSingle("form[@title='Rechner']")
Report.Info("Dialog exists = " + exists.ToString())atom wrote:If your developers are lazy your error dialogs may have no window title
Users browsing this forum: No registered users and 0 guests