Cannot get data from table(datagrid) in desktop app

Ask general questions here.
aguirre.lawrence
Posts: 4
Joined: Thu Oct 15, 2015 10:09 am

Cannot get data from table(datagrid) in desktop app

Post by aguirre.lawrence » Thu Oct 15, 2015 12:11 pm

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.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Fri Oct 16, 2015 12:26 pm

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
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aguirre.lawrence
Posts: 4
Joined: Thu Oct 15, 2015 10:09 am

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

Post by aguirre.lawrence » Mon Oct 19, 2015 6:07 am

Please see attached snapshot.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Mon Oct 19, 2015 7:45 am

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? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aguirre.lawrence
Posts: 4
Joined: Thu Oct 15, 2015 10:09 am

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

Post by aguirre.lawrence » Wed Oct 28, 2015 5:49 am

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.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Wed Oct 28, 2015 8:09 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration