我正在自动化网页编辑任务。该网页在框架内有一个动态表格。每行有五列。动态表是指在网页上动态加载行。在任何给定点,加载的行数都不超过 22。我可以通过移动滚动条访问更多行。表中的总行数约为 450,我需要读取所有行以修改第 2 列中的一些值。我目前正在使用 Selenium WebDriver 尝试将行读入 List,但只能接收 22 行在任何给定时间。这是我尝试过的:
IWebElement tableElement = Driver.driverInstance.FindElement(By.XPath(*tableXPath*));
var rowList = tableElement.FindElements(By.TagName("tr"));
Console.WriteLine("Table rows: " + rowList.Count());
有什么方法可以将整个表(450 行)读入数据结构,以便对它们进行内存处理?
这是通过 FireBug 的 HTML 部分的样子:
<table id="ctl00_MPH_HyperGrid1ContentTable" class="HyperGrid" style="table-layout: fixed; width: 100%;">
<colgroup>
<tbody>
<tr id="ctl00_MPH_HyperGrid1_10" class="" style="height: 37px;">
<tr id="ctl00_MPH_HyperGrid1_11" class="alt" style="height: 37px;">
<tr id="ctl00_MPH_HyperGrid1_12" class="" style="height: 37px;">
<td class="checkable">
<td class="">AntelopeEB</td>
<td class="">CA - Antelope EB</td>
<td class="">SmarterMail</td>
<td class="">User</td>
<td class="">
<td class="loadingCell" colspan="5" style="display:none;">Loading...</td>
</tr>
<tr id="ctl00_MPH_HyperGrid1_13" class="alt" style="height: 37px;">
<tr id="ctl00_MPH_HyperGrid1_14" class="" style="height: 37px;">