Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
Posted: Tue Oct 01, 2013 3:48 pm
This is still a problem any estimate on its resolution?
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
and the call to
Fail to find any controls; even though Spy find the control with no difficulty using the *EXACT* same object path. (FindSingle() of course throws an exception in response to the failure to find)
Then, for reasons I cannot discern, suddenly the call to
will find 0 objects matching the given path, but the call to:
will find 1 object; e.g. the OK button listed above.
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:
In the mean time, I will try slash-less RxObject paths in my calls to Host.Local.Find() and Host.Local.FindSingle().
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);
}
}