Unable to read header text in a datagrid from code randomly

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Unable to read header text in a datagrid from code randomly

Post by sherinjab » Mon Apr 30, 2018 2:21 pm

Hi,

I need to read the column names of a datagrid which is dynamic and my code works sometimes but does fail a lot too. I have the correct rxpath to access these text values and it works every time I use it on Ranorex Spy, however when I debug the code to test the same Rxpath using the following code, it returns an empty list

Code: Select all

Host.Local.Find(path, duration).ToList();
Does anyone know what I can change to make this more stable?

Thanks,
Sherin

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

Re: Unable to read header text in a datagrid from code randomly

Post by odklizec » Mon Apr 30, 2018 2:54 pm

Hi,

Unfortunately, there is not much anyone here can do or suggest without seeing your app under test or at very least a Ranorex snapshot of the problematic element. Also, we need a lot of more details about the error, app under test and your testing environment.

What UI technology we are talking about?
What version of Ranorex do you use (latest is 8.1.1)?
Is there a specific need to use Find method, instead of using GetValue action associated with repository element?
Are you sure that the xpath used in Find is unique and ALWAYS points to correct element (please post a sample xpath along with ranorex snapshot...NOT screenshot).
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

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to read header text in a datagrid from code randomly

Post by sherinjab » Mon Apr 30, 2018 3:24 pm

Hi,

We do not use Ranorex Studio but Ranorex dlls are used in our framwork to access controls based on the rxpath and using methods like FindSingle for single element and Find for a list.

Its a WPF desktop application and I'm using Ranorex 8.0. The rxpath is
/form[@wpfnative='True' and @title='Hubble [DEMO900]' and @processname='Hubble']/container/container/?/?/container[@automationid='dockPanel']/container[2]//element/container/container/container[2]/container[1]/container[@automationid='dataGridControl']/table[@automationid='dataGrid']//container[@automationid='centeringGrid']/container[@automationid='PART_ColumnHeadersPresenter']/cell/container/text

My snaphsot is more than 1MB so unable to upload it here. Please let me know how I can share it with you.

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

Re: Unable to read header text in a datagrid from code randomly

Post by odklizec » Mon Apr 30, 2018 3:29 pm

Hi,

At first, there is no snapshot attached to neither of your posts ;) At next, latest version is 8.1.1. I would strongly recommend to use this version over 8.0. There were a lot of bug fixes done between 8.0 and 8.1.1.

The xpath you posted is somewhat long and complicated and because of the use of indexes, it's pretty fragile. It may very well bet that the element is sometimes misidentified with something else with no text at all? Unfortunately, without snapshot, it's impossible to tell more.

PS: after posting my answer, I found that the snapshot is too big? So then you can use a public file sharing service (like One Drive or Drop Box) and here post a link.
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