标签:
1.可以用xpath循环点击checkbox
List<WebElement> list = dr.findElements(By.className("datagrid-row")); int size = list.size(); if(size>0){ for(int i=0;i<size;i++) { int j = i+1; String index = "/html/body/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr["+j+"]"; String xpt = "/html/body/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr["+j+"]/td[9]/div"; WebElement we = dr.findElement(By.xpath(index)); we.findElement(By.tagName("input")).click();
2.可以用List循环点击
List<WebElement> list = dr.findElements(By.className("datagrid-row")); int size = list.size(); if(size>0){ for(int i=0;i<size;i++) { int j = i+1; String xpt = "/html/body/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr["+j+"]/td[9]/div"; WebElement we = list.get(i); we.findElement(By.tagName("input")).click();
标签:
原文地址:http://www.cnblogs.com/qiaoyeye/p/4564269.html