Java 如何使用selenium在ng repeat table中单击复选框

Java 如何使用selenium在ng repeat table中单击复选框,java,selenium,checkbox,angularjs-ng-repeat,ui-automation,Java,Selenium,Checkbox,Angularjs Ng Repeat,Ui Automation,我正在使用SeleniumJava自动化一个web应用程序,这个web应用程序有一个重复表,如下所示,它创建一行,每行中都有一个复选框。我需要根据要测试的条件选择几个复选框 我正在使用下面的代码查找这些复选框,但无法找到并单击 // To locate table. WebElement mytable = driver.findElement(By.xpath("//table[@class='table']/tbody")); // To locate rows of

我正在使用SeleniumJava自动化一个web应用程序,这个web应用程序有一个重复表,如下所示,它创建一行,每行中都有一个复选框。我需要根据要测试的条件选择几个复选框

我正在使用下面的代码查找这些复选框,但无法找到并单击

    // To locate table.
    WebElement mytable = driver.findElement(By.xpath("//table[@class='table']/tbody"));
    // To locate rows of table.
    List<WebElement> rows_table = mytable.findElements(By.id("check"));
    // To calculate no of rows In table.
    int rows_count = rows_table.size();
    System.out.println(rows_count);
//以查找表。
WebElement mytable=driver.findElement(By.xpath(“//table[@class='table']/tbody”);
//查找表的行。
列出行\u table=mytable.findElements(By.id(“check”);
//计算表中的行数。
int rows\u count=rows\u table.size();
系统输出打印项次(行数);
网页源代码如下所示

`<table class="table" ng-cloak> 
<tbody>
<tr ng-repeat="C orderBy : colsort:reverseSort">
<td>
<input id="check" type="checkbox" ng-checked="C.Addc" ng-model="C.Addc" ng-    click="FindMsg(C.Addc,C.MSG)" />
</td>
<td>
{{C.ItemCode}}
</td>
<td>
{{C.Code}}
</td>
<td title="{{C.LongDescription}}">
{{C.LongDescription.substr(0,30)}}...
</td>
<td style="width: 40px; text-align: right">
{{formattingEnd(C.Enduserprice)}}
</td>
<td>
{{C.type}}
</td>
<td>
{{C.statusflag.toUpperCase}}
</td>
<td>
{{C.SInstType}}
</td>
</tr>
</tbody>
</table>`
`
{{C.ItemCode}
{{C.Code}}
{C.LongDescription.substr(0,30)}。。。
{{formatingend(C.Enduserprice)}
{{C.type}}
{{C.statusflag.toUpperCase}
{{C.SInstType}}
`

ngWebDriver工作起来很有魅力

ngWebDriver=新的ngWebDriver((JavascriptExecutor)驱动程序);
ngWebDriver.waitForAngularRequestsToFinish();
List wes=driver.findElements(ByAngular.repeater(“SearchCPE中的C”);

System.out.println(“行计数为:+wes.size())

您用来单击的代码在哪里?带有
id=“checkCPE”
的元素是什么?首先,我试图识别复选框并使用下面的代码计数。但它正在返回0。id=“check”是表的每一行中重复的复选框。列出行\u table=mytable.findElements(By.id(“check”);检查页面上是否有多个表,以及您的表是否位于
iframe
/
frame