Page 1 of 1

Retreive the row/Co count from a web TableTag and cell val

Posted: Thu Oct 13, 2016 6:12 pm
by nivasd16
Hi Team
I am working a web application, in that i need to retrieve the row and column count of a web table and also find the row based on the column cell value and select that row. When i did the spy its identifying as " TableTag" but not the table

can any one help me in providing a code snippet for this

Attached the objet spy element snapshot

Re: Retreive the row/Co count from a web TableTag and cell val

Posted: Fri Oct 14, 2016 12:44 pm
by Support Team
Hi nivasd16,

The row count could be read via the following code. First, you will need to add the TBody element to the repository. After that, you could search for all TrTags that are children elements of the table body.
add_TBody_to_repository.png

Code: Select all

int rowCount = repo.Dom.TableBody.FindChildren<TrTag>().Count;
The same approach could be used for reading the number of columns.

Code: Select all

int columnCount = repo.Dom.Colgroup.FindChildren<ColTag>().Count;
The row could be selected based on any cell value as follows. An advanced RanoreXPath sample could be found in our user guide.

Code: Select all

/dom[@domain='ess-pt1.np.costco.com']//iframe[#'contentAreaFrame']//iframe[#'ivuFrm_page0ivu0']//span[@innertext='ADMINISTRATION SEATTLE WA']/../parent::tr
I hope this information will help you.

Sincerely,
Johannes