Page 1 of 1

Table object in Ranorex

Posted: Tue Nov 19, 2013 8:17 pm
by jonesj
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?

Re: Table object in Ranorex

Posted: Tue Nov 19, 2013 8:33 pm
by krstcs
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.

Re: Table object in Ranorex

Posted: Thu Nov 21, 2013 9:18 pm
by jonesj
thanks that works