4

I am using WatiN to launch an SSRS report, which gets displayed on a new browser window.I saw the HTML of the report and found that SSRS arranges it in a table.
I am interested in fetching the values of one TD(s)(which in the example below is 11,202.63):

<DIV class="r11">ARSystemBalance </DIV></TD><TD class="a67"><DIV class="r11">: 11,202.63</DIV>

What should be the best method to fetch this value ?

4

2 回答 2

1

我们在 waitin 中创建测试管理器时也遇到了同样的问题,但是我们通过在任何给定表中查找文本并从那里返回 tr 来解决这个问题,请从我们用 C# 编写的以下代码中获取帮助

TableRow tr = table.TableCell(Find.ByText(regex)).ContainingTableRow; 返回 tr;

谢谢

于 2012-12-27T09:48:51.423 回答
0

以下代码片段可能会对您有所帮助

TableRow SearchTable(string TableId, string data, int page) { Table table = ie.Table(Find.ById(TableId));

        Regex regex = new Regex(data + @".*");

        if (table.TableCell(Find.ByText(regex)).Exists)
        {
            TableRow tr = table.TableCell(Find.ByText(regex)).ContainingTableRow;
            return tr;

        }
        else
        {
            int n = table.Tables[table.Tables.Count - 1].Links.Count;
            if (page < n)
            {
                table.Tables.First().Links[page].Click();
                ie.WaitForComplete();
                System.Threading.Thread.Sleep(5000);
                return (SearchTable(TableId, data, page + 1));
            }
            else
                return null;
        }
    }
于 2012-12-31T06:55:04.930 回答