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

Class library usage, coding and language questions.
nivasd16
Posts: 14
Joined: Fri Jan 22, 2016 11:17 pm

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

Post by nivasd16 » Thu Oct 13, 2016 6:12 pm

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
Attachments
ElementSnapshot.rxsnp
Element Snapshot
(487.87 KiB) Downloaded 40 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Fri Oct 14, 2016 12:44 pm

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
add_TBody_to_repository.png (7.99 KiB) Viewed 658 times

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
.
Image