EvolMonster
Programmer
Hiya guys
Ok, here's the setup.
I am using Watin to navigate through a website. When I reach a certain page, I am grabbing the table details, and looking for a certain bit of text, so I can grab the next indexed cell.
To do this, i am navigating using the Watin addon, and Linq, to query the table and its rows / cells.
The code looks like :
----------------------------------------------------------
public static string GetNextCellText(this WatiN.Core.IE ie, string searchText)
{
var rowValue = (from rTable in ie.Tables.Cast<Table>()
from rRow in rTable.TableRows.Cast<TableRow>()
from resultsCell in rRow.TableCells.Cast<TableCell>()
where resultsCell.Text.StartsWith(searchText)
select new
{
CellIndex = resultsCell.Index,
Row = rTable.TableCells,
RowIndex = rRow.Index
}
).First();
int Index = rowValue.RowIndex + 1;
TableCell returnValue = rowValue.Row[Index];
return returnValue.Text;
-----------------------------------------------------------
Hope that formatted ok!
So, the problem is, when I search for some text, the returned cell is always the first cell in the table.
I then add one to the cell, and it goes to index 1. But the problem is, the cell I want is in index 3!
Could it be, that even though I am comparing the cell text, and returning this cell, the fact that I am returning the first cell, means that index 0 is always returned?
Thanks!
DB
Ok, here's the setup.
I am using Watin to navigate through a website. When I reach a certain page, I am grabbing the table details, and looking for a certain bit of text, so I can grab the next indexed cell.
To do this, i am navigating using the Watin addon, and Linq, to query the table and its rows / cells.
The code looks like :
----------------------------------------------------------
public static string GetNextCellText(this WatiN.Core.IE ie, string searchText)
{
var rowValue = (from rTable in ie.Tables.Cast<Table>()
from rRow in rTable.TableRows.Cast<TableRow>()
from resultsCell in rRow.TableCells.Cast<TableCell>()
where resultsCell.Text.StartsWith(searchText)
select new
{
CellIndex = resultsCell.Index,
Row = rTable.TableCells,
RowIndex = rRow.Index
}
).First();
int Index = rowValue.RowIndex + 1;
TableCell returnValue = rowValue.Row[Index];
return returnValue.Text;
-----------------------------------------------------------
Hope that formatted ok!
So, the problem is, when I search for some text, the returned cell is always the first cell in the table.
I then add one to the cell, and it goes to index 1. But the problem is, the cell I want is in index 3!
Could it be, that even though I am comparing the cell text, and returning this cell, the fact that I am returning the first cell, means that index 0 is always returned?
Thanks!
DB