Exception:
Code: Select all
Ranorex.ElementNotFoundException: No element found for path './/button[@controlname='btnCancel' or @text='btnCancel']' within 1m.
at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout)
at Ranorex.Adapter.FindSingle(RxPath path, Duration timeout)
at RanorexFramework.RFW.PushButtonClick(Form RanorexFormName, String PushButtonName, Boolean boolHideNotFoundError) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\RanorexFramework\RanorexFramework\Class1.cs:line 5452
Here is my code:
1st, I find the form I want to deal with (this works)
Code: Select all
Ranorex.Form HDStartupForm = RFW.WaitForWindow("HD Startup", 10);
if (HDStartupForm == null)
{
Report.Debug("Did not find the Hard Dollar Startup dialog");
}
else
{
Report.Debug("Found Hard Dollar Startup dialog");
Report.Debug("Closing the dialog.");
intResult = RFW.PushButtonClick(HDStartupForm, "btnCancel");
if (intResult == -1)
{
return null;
}
RFW.WaitForWindowCloseByForm(HDStartupForm, 60);
}
Code: Select all
RanorexFormName.EnsureVisible();
RanorexFormName.Activate();
Thread.Sleep(500);
HDbutton = RanorexFormName.FindSingle(".//button[@controlname='" + PushButtonName + "' or @text='" + PushButtonName + "']", 60000);
Code: Select all
/form[@controlname='OpeningForm']/button[@controlname='btnCancel']