Selenium定位下拉框中的元素与普通元素定位有所不同,下面介绍三种定位下拉框元素的方法. 下拉款HTML代码如图所示: 一.通过text定位 //获取下拉框对象 Select city = new Select(driver.findElement(By.name("city"))); //通过text值定位 city.selectByVisibleText("驻马店"); 二.通过value定位 //获取下拉框对象 Select city = new Sele
方法一 Controller 部分代码: public ActionResult Modify(int id) { //3.1.1 检查id //3.1.2根据id查询数据 Models.Student stu = (from s in db.Students where s.Id == id select s).FirstOrDefault(); //方法一.查询班级数据,并 做成 下拉框 选项集合 //List<Models.Class> listClass = (from c in d