Table object in Ranorex

Ask general questions here.
jonesj
Posts: 7
Joined: Wed Sep 25, 2013 4:02 pm

Table object in Ranorex

Post by jonesj » Tue Nov 19, 2013 8:17 pm

So I am following the code examples on the Ranorex tutorial for use of tables.
I try using the table object to list the elements of a table.

The site of the table grid: //trirand.com/blog/jqgrid/jqgrid.html
Under grouping and then under hide grouping

Here is the object and ranorex xpath

Table t = "/dom[@domain='trirand.com']//table[#'list482']";

I get this error:
The element does not support the required capability 'table'.

Now it works for table tag but I have to drill down to the table elements. Why can't I just use the table object and just for loop through the elements?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Table object in Ranorex

Post by krstcs » Tue Nov 19, 2013 8:33 pm

Technically it is NOT a table, but a tabletag object, so it cannot use the table adapter. If you manually create an object (as opposed to using the instant tracking option or recording, etc.) in the repository and it is a tabletag element, you will need to use the "/tabletag[]" adapter in the RanoreXPath, or change the adapter type in properties to "tabletag".

In code it should be:

Code: Select all

TableTag t = "/dom[@domain='trirand.com']//table[#'list482']";
And you can loop through the elements if you do a find on the XPath you want.

Code: Select all

foreach (TrTag tr in t.Find<TrTag>("tr[@myID='whatever you use to id the row']") {
    //do whatever you want with the tr here...
}
You have to remember that HTML is not the same as standard code, so the structure is different. There is nothing Ranorex can do about that, they just give us the tools to work with it.
Shortcuts usually aren't...

jonesj
Posts: 7
Joined: Wed Sep 25, 2013 4:02 pm

Re: Table object in Ranorex

Post by jonesj » Thu Nov 21, 2013 9:18 pm

thanks that works