I am automating a web application using Selenium Java, this web application has angular js ng-repeat table as below which creates row with checkbox inside each row. I need to select few checkbox based on condition to test.
I am using below code to find these checkbox but unable to find and click.
// 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("checkCPE"));
// To calculate no of rows In table.
int rows_count = rows_table.size();
System.out.println(rows_count);
Webpage source looks like below
`<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>
</td>
<td>
</td>
<td title="">
...
</td>
<td style="width: 40px; text-align: right">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>`
Aucun commentaire:
Enregistrer un commentaire