Creating DataTable from Table

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Creating DataTable from Table

Post by cpalex » Thu Jan 23, 2020 7:38 pm

We do a lot of grid validations in our automation, and it can become a little cumbersome with larger projects.

I've gotten pretty good at working with Datatable objects in C#, and could easily use that to do many of my validations.

However, I am at a bit of a loss on how I might be able to create a Datatable object from a Ranorex Repository item.

For example, in Spy, you can see a Table item. Its immediate children include the rows inside the table, and the rows have cells
grid.png
grid.png (5.55 KiB) Viewed 270 times
I would like to create a data table object where the table is the object, the Rows are the rows, and the Cells are the columns.

Row 0 becomes the Column Header names.

Any idea if this is possible? It would greatly improve the power of our user code when doing larger table validations.

Additionally, this table is being identified through the Delphi extension.

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

Re: Creating DataTable from Table

Post by odklizec » Fri Jan 24, 2020 8:11 am

Hi,

Without seeing, at very least, Ranorex snapshot (NOT screenshot) of the table, it's very hard to suggest something reliable. I think your best hope is to check this code sample, showing a general approach how to validate table elements, and adapt this sample to work with your table...
https://www.ranorex.com/help/latest/han ... ntiretable
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

cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Re: Creating DataTable from Table

Post by cpalex » Fri Jan 24, 2020 3:40 pm

That's exactly what I was looking for, thank you! I think I can start there and get to where I want to go

cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Re: Creating DataTable from Table

Post by cpalex » Mon Jan 27, 2020 6:16 pm

Ok, so the major issue I am running into now, is that the snapshot is grabbing the entire application. Because of the way we built our application, there are some drop downs in inactive tabs that contain thousands of list items, ant it causes snapshots to take over a minute to create.

Even though the Create Snapshot action is only pointing at the grid element I want to see, the snapshot is a complete application snapshot. I've gone through the documentation and API reference, and I haven't been able to figure out a method for limiting the scope of the snapshot to the element in question and its children, to make the snapshot build quickly.

Is this possible?

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

Re: Creating DataTable from Table

Post by odklizec » Mon Jan 27, 2020 9:26 pm

Hi,

Could you please share the snapshot and full xpath to repo element you are using for Create Snapshot action? It’s definitely not normal that the Create Snapshot action takes snapshot of the whole app. But it’s impossible to tell what’s wrong without seeing the xpath and reference snapshot. Thanks.
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

cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Re: Creating DataTable from Table

Post by cpalex » Tue Jan 28, 2020 5:05 pm

Unfortunately, my company would prefer I don't post specific items in the forum. I will open a support ticket with Ranorex, and just report back what we figure out

cpalex
Posts: 36
Joined: Sat Feb 17, 2018 12:37 am

Re: Creating DataTable from Table

Post by cpalex » Thu Jan 30, 2020 3:21 pm

Looks like it was in the API, just not where I was looking:

var table = repo.RanorexVIPDatabaseTestWebApplicatio.table;

ElementSnapshot snap = ElementSnapshot.Capture(table, false, false);
snap.SaveToFile("snap.rxsnp", true);

API Documentation:
https://www.ranorex.com/Documentation/R ... ture_1.htm
https://www.ranorex.com/Documentation/R ... ToFile.htm

This ran MUCH faster, and should give me access to the object I need for my comparison code.

YakForger
Posts: 3
Joined: Fri Feb 21, 2020 4:24 pm

Re: Creating DataTable from Table

Post by YakForger » Mon Feb 24, 2020 1:45 pm

Great, thanks for the feedback, that's really helpful!