c# - Windows UI Automation API not finding child elements when run on server -


I am using NUnit 2.5.10 tests to test automated UI for WPU applications.

In some cases where running a test on my development machine is capable of detecting some UI elements, but when our scheme runs the same script on our build agent machine, then finding those elements Are unable to.

I am not getting any reason, because the agent machine behaves differently. I suspect that there is something with the UIAIT flag or UAC, but nothing is specific.

Can anybody provide guidance on why the build agent should behave differently, or how to fix the agent to see the same elements as my other machines?

For example, I have a combo box, in which there are about a dozen options, using the "Object Objects" tool from the Win7 SDK, I can see that There is a child element that contains the actual display text. So in my test code, I do something like this:

  // Option of child elements option = combo box element.Find all (Treescope children, (system.industo.automation.condition ) New Property Condition (AutomationAlment.iscentralAlmentproperty, (object) is true)); Vorach (Authentication Element child view option) {var all controls = child. Gate Child (); Console.print line ("child: {0} w / {1} children", child. Present name, sub control.); Next count (Automation element sub-control under sub-control) console WrightLine ("subcontrol: {0}", sub-control. Current name); }   

On my dev machine, I get these results:

  Hair: My.BoundObject.ClassName w / 1 child sub-control: first item Displayed children for: My.BoundObject.ClassName w / 1 child's sub-control: text displayed for the second item Child: My.BoundObject.ClassName w / 1 children subcontroll: text displayed for the third item  < / Pre> 

But the server, I get this:

  Child: mine. Bound object Classname w / 0 children's hair: mine.bound object Class name w / 0 Child: Mybound object.Classname w / 0 children   

Inspect objects in both cases, shows child objects  Inspect option screenshot

Both build agents and my local machine are running Windows 7 SP1 .Net 4. Both cases In, I'm running nunit-console.exe to stop the trial. I am copying the entire environment between machines, not only this is the same version of the nunit and my app's binaries, this is the same file, config, libraries, etc. Run as a nunit-console administrator user. After running the scenarios on several machines, I was able to determine that those machines were installed with 4.5 machines. Able to reach the elements of the child, while only. People with 4.0 were not Note that applications and tests were compiled for all .Net 4.0.

Hope this helps anyone else with this problem.

Comments