Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Testing 使用SeleniumWebDriver从动态表中获取所有行_Testing_Selenium_Selenium Webdriver_Automation_Dynamic Tables - Fatal编程技术网

Testing 使用SeleniumWebDriver从动态表中获取所有行

Testing 使用SeleniumWebDriver从动态表中获取所有行,testing,selenium,selenium-webdriver,automation,dynamic-tables,Testing,Selenium,Selenium Webdriver,Automation,Dynamic Tables,我正在努力实现网页编辑任务的自动化。该网页在一个框架内有一个动态表。每行有五列。动态表是指在网页上动态加载行。在任何给定点,加载的行数不超过22。我可以通过移动滚动条访问更多行。表中的行总数约为450行,我需要读取所有行以修改第2列中的某些值。 我目前正在使用SeleniumWebDriver尝试将行读取到列表中,但在任何给定时间只能接收22行。以下是我尝试过的: IWebElement tableElement = Driver.driverInstance.FindEleme

我正在努力实现网页编辑任务的自动化。该网页在一个框架内有一个动态表。每行有五列。动态表是指在网页上动态加载行。在任何给定点,加载的行数不超过22。我可以通过移动滚动条访问更多行。表中的行总数约为450行,我需要读取所有行以修改第2列中的某些值。 我目前正在使用SeleniumWebDriver尝试将行读取到列表中,但在任何给定时间只能接收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;">

羚羊
CA-羚羊EB
智能邮件
使用者
加载。。。
“在任何给定点,加载的行数不超过22”


这意味着selenium只能访问22行并存储到列表数据结构中,因为浏览器只有22行

您需要通过SELENIUM触发一个事件,使剩余的数据显示在浏览器中,以便SELENIUM可以检索接下来的22个标记

您提到可以通过滚动访问更多行,包括一个可以触发滚动事件的函数。利用线程睡眠(毫秒);如果页面内容加载缓慢。如果您需要更多信息,请告诉我,也请共享代码

您说过可以通过滚动加载新行。答案是:滚动,阅读新行,然后重复,直到最后。如果您正在代码中寻找解决方案,则需要将URL与表一起发布。