3

I m trying to capture all the sub tree elements of a particular application, in some machines I m getting all the elements, but in some machines half of the elements (i.e. Child Elements) are missing.

FindAll(TreeScope.Subtree, Condition.TrueCondition);

I have tried installing Microsoft .NET Framework 4.5 but no luck

What might be the issue? why UI Automation is behaving differently in different machines? What might be missing in client machine which is not allowing UI Automation to fetch all the child elements?

Is Microsoft .NET Framework 4.5 SDK is also required in client machine? System configuration:

Developers Machine: (Working Fine)

Operating System: Windows 7 Professional

Developing App: Visual Studio 2012 Professional

.NET Framework: 4.5.2

.NET Framework SDK: 4.5

Client Machine: (Can't able to fetch child elements)

Operating System: Windows 7 Professional

.NET Framework: 4.5

.NET Framework SDK: NA

There is no extra software installed in developer machine, Framework and Framework SDK was also installed by Visual Studio 2012 only.

Code to fetch element is straightforward, I m trying to fetch the element on mouse location:

System.Windows.Point _location = new System.Windows.Point(Cursor.Position.X,Cursor.Position.Y);

AutomationElement _ele = AutomationElement.FromPoint(_location);
Amit Chauhan
  • 230
  • 2
  • 20

2 Answers2

0

I don't know why the problem exist but I have already seen in a tested application that sometimes a parent node have to be selected and clicked to expand its childs nodes in order they could be seen via automation.

So what you can do is to create your custom find method which selects and clicks a node to expand it before trying to retrieve its child nodes.

Maxwell77
  • 918
  • 6
  • 16
  • Its not just about the expandable fields, in many cases (machines), the visible child elements (Like labels in the status bar or elements inside grid) are also not accessible. I have tried installing .Net Framework 4.5 but no luck. – Amit Chauhan Feb 19 '17 at 13:46
  • We have already tried with all the versions of .NET from 4.5 to 4.6.2, but no luck. In all the developers machine (where VS is installed) it is working fine, what might be the environment difference? – Amit Chauhan Feb 27 '17 at 15:32
  • Could it be difference from user account rights ? Maybe you should try to run your tests in administrator mode... – Maxwell77 Feb 27 '17 at 16:31
  • No, both machines are running with same privileges. Is it possible that visual studio accelerate user privileges? FYI - Visual Studio .net running with non-administrative privileges. – Amit Chauhan Feb 28 '17 at 04:40
  • Have you inspect the components tree with Inspect or UISpy to see if there are differences between the two machines ? Just to see if the problem comes from White ou Automation... – Maxwell77 Mar 03 '17 at 10:25
  • @AmitChauhan have you maybe found out what the issue was? :-D – Filip5991 Dec 11 '19 at 12:19
  • Hi @filip after signing our exe we started getting all the required elements, signing exe will increase the access privileges of your application. I hope this will help you also. – Amit Chauhan Dec 12 '19 at 16:38
0

After signing our exe we started getting all the required elements, signing exe will increase the access privileges of your application.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Amit Chauhan
  • 230
  • 2
  • 20