Page 1 of 1

Cannot get data from table(datagrid) in desktop app

Posted: Thu Oct 15, 2015 12:11 pm
by aguirre.lawrence
Hi,

I'm trying to get the row count of the table(datagrid) in a desktop application but it always returns zero. What are the possible issue here?

Here's my code:
Dim repo As DPSRepository = DPSRepository.Instance
Dim previewGrid As Ranorex.Table = repo.TestHarnessMainWindow1.PreviewGrid
msgbox(previewGrid.Rows.Count)


Ranorex version: 5.4.2
.NET Runtime Version: 4
OS: Windows 7 Professional Service Pack 1
AUT: .NET-based desktop application

Please see attached screenshot of the repository properties.

Thanks in advance.

Re: Cannot get data from table(datagrid) in desktop app

Posted: Fri Oct 16, 2015 12:26 pm
by odklizec
Hi,

Could you please post a Ranorex snapshot of the element in question? Screenshot is unfortunately not helpful here. You can find how to create one here...
http://www.ranorex.com/support/user-gui ... files.html

Re: Cannot get data from table(datagrid) in desktop app

Posted: Mon Oct 19, 2015 6:07 am
by aguirre.lawrence
Please see attached snapshot.

Re: Cannot get data from table(datagrid) in desktop app

Posted: Mon Oct 19, 2015 7:45 am
by odklizec
Hi,

It seems to me that you are using old UIA plugin? This is probably why there are no cells recognized by Ranorex? UIA method of recognition is old and recommended to use only in case the WPF Preferred/Only (native WPF plugin) fails to recognize some WPF elements.

Please try to enable WPF Preferred (or WPF Only) in Ranorex Global Settings (follow my post here...
http://www.ranorex.com/forum/how-do-i-e ... tml#p34821). This should greatly improve Ranorex WPF recognition capabilities. Hope this helps? ;)

Re: Cannot get data from table(datagrid) in desktop app

Posted: Wed Oct 28, 2015 5:49 am
by aguirre.lawrence
Thanks for your response. But when I already changed the Global Settings, the table cell values are being identified as Element (Please see attached snapshot). How can I retrieve the table values if this is the case? Thanks in advance.

Re: Cannot get data from table(datagrid) in desktop app

Posted: Wed Oct 28, 2015 8:09 am
by odklizec
Hi,

Unfortunately, it looks as the elements does not display their content? And generally, grid as such does not appear to be identified very well with WPF Plugin?

What else you can try is to set "Realize Items in Virtualizing Containers" and "Show all elements" to true, as described here:
http://www.ranorex.com/forum/unable-to- ... tml#p33791
If it does not help, let these options enabled and try UIA Only instead of WPF Preferred. Just follow some other suggestions from the above post.

The last thing you can try is GDI Capture List, as described here:
http://www.ranorex.com/support/user-gui ... tions.html
Unfortunately, It's useful mainly for simple elements. Using it for large grids is not very comfortable and reliable solution.