Hi team,
I'm trying to write code (CSharp) to interrogate a table (Flex) by looking up a particular cell (which I can do successfully) and then return the related values in several adjacent columns - within the same row.
Looking at examples, I can see two ways that one might normally do this: i) use following or preceding sibling or ii) after identifying the matching cell, then simply go up one level to get to the row and then go down again and specify the actual column number.
However this will not work for me, because the table hierarchy is organized such that each column element is directly subordinate to the table and within each column element we have a list of rows (each containing a single cell). Therefore if I go up a level I simply get the column group containing all the cells in the column.
Essentially, it seems that I need to be able to somehow find the index number (rownumber) of the matched element in the column and then using that rownumber, lookup the cell in a different column.
Can this be done and if so, how?
Cheers,
Mark
Get related column when column/row hierarchy is switched
-
- Posts: 7
- Joined: Thu Jan 24, 2013 12:40 am
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Get related column when column/row hierarchy is switched
Hello Mark,
I'm not sure how your table looks like, but you could use the RxPath to get the "rowindex" property of the current cell.
Example:
Regards,
Bernhard
I'm not sure how your table looks like, but you could use the RxPath to get the "rowindex" property of the current cell.
Example:
var firstCell = @"/dom[@domain='www.youdomain.com']//table/column[@text='Column1']/cell[@text='YourCell']"; int rowIndex = midWest.RowIndex; Ranorex.Cell secondCell = @"/dom[@domain='www.youdomain.com']//table/column[@text='Column2']/cell[@rowindex='"+ rowIndex.ToString() +"']"; Report.Info(secondCol.Text);I hope this is what you want to do.
Regards,
Bernhard
-
- Posts: 7
- Joined: Thu Jan 24, 2013 12:40 am
Re: Get related column when column/row hierarchy is switched
Thanks Bernhard,
I actually used ChildIndex from the Element member, but did effectively the same thing as you suggest there.
I suspect RowIndex will only work if you have an actual Cell adapter.
Regards
Mark
I actually used ChildIndex from the Element member, but did effectively the same thing as you suggest there.
I suspect RowIndex will only work if you have an actual Cell adapter.
Regards
Mark