0
我試圖單擊表格中的複選框。我在表中搜索,當我發現在第2列適當的信息我想點擊複選框在該行單擊活動行第一列中的複選框
public WebDriver searchSelectStore(WebDriver dr1, String srchTable, String srchFor) {
// Grab the table
WebElement table = dr1.findElement(By.id(srchTable));
// Now get all the TR elements from the table
List<WebElement> allRows = table.findElements(By.tagName("tr"));
// And iterate over them, getting the cells
for (WebElement row : allRows) {
List<WebElement> cells = row.findElements(By.tagName("td"));
for (WebElement cell : cells) {
//
if(cell.getText().equals(srchFor)){
System.out.println(row.getText());
// here I need to click on the first column of that row
}
}