last day (16 days later) » 

10:24 AM
0
Q: Finding Controls in WPF DataGrid? Using Coded UI

Surya sasidharI am automating the WPF application using coded UI, I am trying to find a row in Data Grid which is unable to find the control, when i ask my developer about the control hierarchy, they said that they put another Data Grid with in the Data Grid. When i record the control which is unable to find t...

 
In Data Grid Row it contain Toggle Button
 
Coded UI cannot see into custom controls unless that custom control includes support for MSAA or UIA. The same support that is needed to allow screen readers etc as used by people with sight problems.
 
i attached the screen shot of my Data Grid, here in the first toggle button i am able to access, but second toggle button is unable to trace.
Thank you for reply @Adrian, it is custom control only, but Technology Name is UIA.
 
When you use the "crosshairs" tool in the Coded UI recorder to view the controls, what does it show? Can it find the innermost controls on the screen? Can it draw a box around just the 4 or the 65 on the bottom line shown in the screenshot? If it can then generate an assert on that value (in a sandbox project if necessary) and copy the relevant bits of code into your test. If it cannot then the custom controls do not support enough of MSAA or UIA.
 
Yes, it shows innermost controls, even toggle button properties able to see when i place cross hair tool, but the same when i try to find the toggle button, it is unable to access. it is throwing error at Custom Controls, like my Custom controls "custDetaPre" i.e., "Uia.DataGridDetailsPresenter"
when i try to find toggle button, through hand code, it is throwing error at custom control , with in that custom control second Data Grid is exists with in that data grid only this second toggle button exists
 
10:24 AM
So record and generate a test. Make it work, then copy the relevant bits into your hand-coded test. There are numerous Q&As here and on other sites about debugging Coded UI tests and getting them to work. Without a Minimal, Complete, and Verifiable example I think you are unlikely to get much better help here on Stack Overflow.
 
I record the controls, but i am getting exception, unable to find the control. I google it before post my question in stack overflow.
 
10:46 AM
You question does not include the exception details, it does not show what you have done to try and understand the problem, it does not show what Google told you about the problem. Had you explained what you had done my first responses might have been more useful to you, or perhaps I would have not responded because you had done all the things I would suggest. Please read [mcve] and think about how you can provide the information that would be needed for anyone to help you.
 
 
1 hour later…
12:15 PM
and I am getting "UITestControlNotFound" Exception
This exception occurring me @ WpfCustom.
when i try to Draw High light, then i am getting excetpion.
custDetaPre.DrawHighlight();
 

  last day (16 days later) »