Page 1 of 1

Rx Object Path depends on how app was started?

Posted: Mon Apr 22, 2013 11:28 pm
by JohnWashburn
I have a small whetstone application to verify testing of winform controls and widgets work / don't work within an application which is much simpler than our commercial winform app that represents man-decades of software development.

if the testing code does not work with winform control within the the whetstone app, that that same testing code will certainly fail when interacting with the same type of winform controls within the commercial app. The name of the simple app is Winform Whetstone.

If the whetstone app is started within a C# program with the Thread.Start(ProcessInfo) method then the Spy states the Rx path of the Close button of the main form is:

/form[@title='Winform Whetstone']/titlebar/button[@accessiblename='Close']

If I start the whetstone application from the operating system by double clicking on the directory entry then the Spy reports the Rx path of the close button of the main form is:

/form[@controlname='Cognex.TA.WinformWhetstone']/titlebar/button[@accessiblename='Close']

Why is this? The EXE has not changed in any way, yet Spy cannot find the ControlName property and uses the Title property instead?

I would prefer the second Rx path be used since the control name and accessiblename properties are language invariant and don't depend on the English text: "Winform Whetstone", for object identification.

I get a similar behavior for the Minimize button as well.

This erratic identification is problematic as I am using the existence of the Close button of the main form as a proxy to question: "Has the application started successfully." Button exist then yes, the application has started.

Re: Rx Object Path depends on how app was started?

Posted: Mon Apr 22, 2013 11:46 pm
by Ciege
It *COULD* be that when you start the AUT from the EXE you are starting it as an Administrator (the way Ranorex requires the AUT to be run to fully recognize elements and such), and when you run the AUT from Thread.Start you are running in another context that Ranorex cannot guarantee what it is able to see or not see within your AUT.

Try setting your Process to RunAs as Admin and re-verify what Ranorex can see and how it sees it...

Re: Rx Object Path depends on how app was started?

Posted: Tue Apr 23, 2013 9:34 am
by Support Team
JohnWashburn wrote:Thread.Start(ProcessInfo)
You meant Process.Start(ProcessInfo), right?

As ciege already suspected, it could be a security or a x86/x64 issue. Are you getting any technology limitation warnings when spying the application after being started from your testing code?

Also make sure that all prerequisites are installed. You can easily ensure that by starting the Ranorex setup file "Ranorex-X.X.X.X.exe" again (do not use the MSI from the unzipped package; running the MSI will not install any prerequisites).

Regards,
Alex
Ranorex Team

Re: Rx Object Path depends on how app was started?

Posted: Tue Apr 23, 2013 2:30 pm
by JohnWashburn
Yes, Process.StartInfo followed by process.Start. The exact code fragment is:

Code: Select all

var process = new Process();
process.StartInfo.FileName = exe;
process.StartInfo.Arguments = args;
process.StartInfo.WorkingDirectory = workingDir;
process.StartInfo.UseShellExecute = true;

// receive notification of process exit
process.EnableRaisingEvents = true;
process.Exited += StartedProcessHasExited;

if (process.Start())
{
}

Re: Rx Object Path depends on how app was started?

Posted: Tue Apr 23, 2013 2:34 pm
by JohnWashburn
I will check the privilege levels. I do get a warning that the Ranorex plug-in is incompatible with Firefox, but since I don't have a web app, I have ignored it. But, that warning seems to come up in all contexts.

But I will pay more attention to security level, (admin or regular) as i am working on this today.

Re: Rx Object Path depends on how app was started?

Posted: Thu Apr 25, 2013 9:07 am
by Support Team
JohnWashburn wrote: I do get a warning that the Ranorex plug-in is incompatible with Firefox, but since I don't have a web app, I have ignored it. But, that warning seems to come up in all contexts.
You can get a warning if you did not install the Firefox plugin and have Firefox open while searching for elements. As soon as Ranorex hits a Firefox window instance, it shows the technology limitation since without the plugin installed it cannot know if elements within the Firefox window could match the RanoreXPath.
JohnWashburn wrote:But I will pay more attention to security level, (admin or regular) as i am working on this today
Would be great if you could post your findings :)

Regards,
Alex
Ranorex Team