Right now I use the UltraUIaTree.GetChildren() coded ui function to find out how many rows are in the WinGrid in my WinForms Application. The problem is that this will return extra rows such as the Band header the summationRow and an addrow (an extra three columns). Therefore when I want to find out how many rows there are using the getchildren method I have to do GetChildren().Count - 3. However, I don't always have an add row so I can't always assume there are three rows there.
Is there a way to get just the count on the dataRows only through Coded UI (no bandHeader/SummationRow/AddRow)?
I have tried using the Nodes property but that didn't seem to return anything.
Hello Jeremy,
There are two articles in MSDN, regarding thrid party controls accessibility, please take a look at them:
http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test-extension-for-3rd-party-windows-forms-controls-how-to.aspx
http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test-extension-for-3rd-party-controls-the-basics-explained.aspx.
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
I am having the same issue.
I want even more :) if i am right for now it not possible to find the row by the value.
Even if i do tree.GetChildren() and loop through the items it is not possible to get the row values or cell values to compare with my desired value.
I tried also regular search like:
----------
tree is UltraUiaTree (but it is actually grid)
UltraUiaEdit edit = new UltraUiaEdit(tree );edit.SearchProperties.Add( UltraUiaEdit.PropertyNames.AutomationId, "Edit", PropertyExpressionOperator.Contains );UITestControlCollection collection = edit.FindMatchingControls();and collection is always 0.
???
Almir,
What are you trying to find exactly? CodedUI works through 'Point's and I believe that this is the case here as well. Am I missing something, please let me know?
Ok:
Can you do assert by cell value on ultra grid?
Let's say like this:
I have a grid row like this
1 | abcd | 12345 | test | true | 112211
I want to assert this grid and see if there is any row that contains cell with value abcd?
Is this clear?
Best
Hello Almir,
In order for FindMatchingControls() to work, you need to make sure the TestControl on which you are calling the FindMatchingControls() exists. I've found it to be difficult to work with, and quite unreliable.
There are some community written utilities which may be of help. For instance, the WpfExtensions utility class has a GetChildren<T>() method which will get all children of a specific type.
For performance reasons, you might want to consider utilizing the underlying UIA framework, instead of looping and searching through the items on the Coded UI Test side of things. Operating on the CUIT side of things is very poor in terms of looping and searching due to the need for the framework to constantly map/match the UITestControls to the underlying elements.
Take a look at this post for a point of reference, and let me know if you have any questions.
Chris
I think this is the best solution so far (and only I think :) )
http://ko.infragistics.com/community/forums/p/78243/410030.aspx#410030
THANKS A LOT!!!