Regarding the slash issue mentioned above. Is the RxObject path provided by Ranorex Spy (such as:
/form[@controlname='SimpleUserAccessSettingsDialog']/container[@controlname='tableLayoutPanel1']//container[@controlname='btnOkay']/button[@accessiblename='&OK']
) incompatible with the RxObject path argument used in calls to Host.Local.FindSingle() and calls to Host.Local.Find() because the RX path provided by Spy has an initial slash? That might explain the bizarre behavior I am experiencing with the code below.
Most of the time both the call to
Code: Select all
var objectsFound = Host.Local.Find<Ranorex.Unknown>(objectPath, new Duration(waitTime));
Code: Select all
var singleUnknownFound = Host.Local.FindSingle<Ranorex.Unknown>(objectPath, new Duration(waitTime));
Then, for reasons I cannot discern, suddenly the call to
Code: Select all
var objectsFound = Host.Local.Find<Ranorex.Unknown>(objectPath, new Duration(waitTime));
Code: Select all
var singleUnknownFound = Host.Local.FindSingle<Ranorex.Unknown>(objectPath, new Duration(waitTime));
Restart the machine and you are back to state where neither Host.Local.Find() nor Host.Local.FindSingle() find any objects at all even though neither the AUT nor the calling code have changed. There is some kind of caching issue within the Host.Local, I just wish I knew what is was.
The C# method which calls Host.Local is:
Code: Select all
private void SeekISEControls()
{
string msgText;
TimeSpan waitTime = new TimeSpan(0, 0, 0, 5); // 5 seconds
string objectPath =
@"/form[@controlname='SimpleUserAccessSettingsDialog']/container[@controlname='tableLayoutPanel1']//container[@controlname='btnOkay']/button[@accessiblename='&OK']"
;
var objectsFound = Host.Local.Find<Ranorex.Unknown>(objectPath, new Duration(waitTime));
int numFormsFound = objectsFound.Count;
string suffixText = (1 == numFormsFound) ? "" : "s";
msgText = string.Format("Found {0} object{1} matching the object path:\n{2}", numFormsFound, suffixText, objectPath);
MessageBox.Show(msgText, "In-Sight Explorer: Host.Local.Find<Ranorex.Button>", MessageBoxButtons.OK);
// if (0 < numFormsFound)
{
var singleUnknownFound = Host.Local.FindSingle<Ranorex.Unknown>(objectPath, new Duration(waitTime));
msgText = string.Format("Found a single UNKNOWN object matching the object path:\n{0}", objectPath);
MessageBox.Show(msgText, "In-Sight Explorer: Host.Local.FindSingle<Ranorex.Button>", MessageBoxButtons.OK);
var singleButtonFound = Host.Local.FindSingle<Ranorex.Button>(objectPath, new Duration(waitTime));
msgText = string.Format("Found a single BUTTON object matching the object path:\n{0}", objectPath);
MessageBox.Show(msgText, "In-Sight Explorer: Host.Local.FindSingle<Ranorex.Button>", MessageBoxButtons.OK);
}
}