Page 1 of 1

Item 'xxxxxx' is no Table

Posted: Wed Jul 22, 2015 7:46 am
by niteshr
Hi Guys,

I have used the spy tool to track an HTML table element. When I try to reference it through code like so:

var PTable = repo.PlayerTable;

I get an error:

Item 'Repository.PlayerTable' is no Table.

I am able to highlight the element etc in the spy.

How do I get past this issue?

Re: Item 'xxxxxx' is no Table

Posted: Wed Jul 22, 2015 7:53 am
by odklizec
Hi,

It's very hard (if not impossible) to help you without some more details about your HTML code and Ranorex solution.

Please provide the following details:
Your Ranorex version (most recent is 5.4, if you are using older version, try the latest one)
Please publish Ranorex Snapshot (not screenshot!) of the table in question. If you cannot publish the snapshot from your production app, try to simulate the problem for example > here < and publish the necessary HTML code.
Sample Ranorex solution with your code and repository would be very helpful too.

Re: Item 'xxxxxx' is no Table

Posted: Thu Aug 13, 2015 5:57 pm
by cwmiller
I had attempted to reply before but it didn't show up in the thread or my posts so sorry if this is a duplicate.

So I have this table in my repository:
RepoTable.PNG
Right now I'm only attempting to count the rows of this table. The table and its child elements are select-able.

I was trying numerous versions of:

Code: Select all

Table t = new Table(repo.ArrowEnVisionHome.RefTable.Self.Element);
return t.Rows.Count;
However I noticed that RefTable.Self returns a Table by default. So any user code operation on this object will encounter this error.

Snapshot:
TableSnapshot.rxsnp
Ranorex Version: 5.4.0.24580
OS: Windows 8.1 Pro
HW Config: Docked laptop?

Re: Item 'xxxxxx' is no Table

Posted: Fri Aug 14, 2015 8:57 am
by odklizec
Hi,

For HTML table, you should use TableTag instead of Table adapter! So the code for obtaining HTML table rows should look like this:
Ranorex.TableTag htmlTable = new Ranorex.TableTag(repo.ArrowEnVisionHome.RefTable);
IList<TrTag> iListTableRows = htmlTable.FindDescendants<TrTag>();
int tableRowsCount = iListTableRows.Count;

Re: Item 'xxxxxx' is no Table

Posted: Fri Aug 14, 2015 5:05 pm
by cwmiller
I suspected something like that. Though, I still cannot directly access the element and cast it to a TableTag since Ranorex by default tries to return it as a Table.
Base-Table.PNG
Self-Table.PNG
I just did the following to get around it:

Code: Select all

return repo.ArrowEnVisionHome.Self.FindSingle(repo.ArrowEnVisionHome.RefTable.BasePath).FindSingle(@"./tbody").Find(@"./tr").Count;

Re: Item 'xxxxxx' is no Table

Posted: Thu Aug 20, 2015 5:03 pm
by Support Team
Hi,

The easiest way would be changing the Adapter Type of the corresponding repository item to tabletag.
Just select the table's repository item and open the properties tab and select tabletag as the Adapter Type as you can see below:
TableTag.png
Regards,
Markus