//select多选下拉框,根据index选择,从0开始
static void selectMultipleIndex(By by, List<Integer> list) {
Select dropList = new Select(driver.findElement(by));
Assert.assertTrue(dropList.isMultiple());//断言支持多选返回ture
for (int a : list) {
dropList.selectByIndex(a);
}
}
//select多选下拉框,根据text选择
static void selectMultipleText(By by, List<String> list) {
Select dropList = new Select(driver.findElement(by));
Assert.assertTrue(dropList.isMultiple());//断言支持多选返回ture
for (String a : list) {
dropList.selectByVisibleText(a);
}
}
//select多选下拉框,根据value值选择
static void selectMultipleValue(By by, List<String> list) {
Select dropList = new Select(driver.findElement(by));
Assert.assertTrue(dropList.isMultiple());//断言支持多选返回ture
for (String a : list) {
dropList.selectByValue(a);
selenium3.0操作select多选下拉框
最新推荐文章于 2024-01-03 12:02:27 发布