选择第二个下拉菜单

时间:2015-06-26 13:21:24

标签: c# webdriver

我可以添加第二个dorpdownmenu来选择

  

错误表明它已经定义为selectElement

的变量

如何添加2个选择下拉菜单

SelectElement selectElement = new SelectElement(driver.FindElement(By.Id("Month")));
selectElement.SelectByText("January");

1 个答案:

答案 0 :(得分:0)

如果您的意思是如何使用2个选择对象:

SelectElement monthDdList = new SelectElement(driver.FindElement(By.Id("Month")));
monthDdList.SelectByText("January");

SelectElement daysDdList = new SelectElement(driver.FindElement(By.Id("Month")));
daysDdList .SelectByText("10");

如果您的意思是如何在DDList中选择几个项目:

SelectElement monthDdList = new SelectElement(driver.FindElement(By.Id("Month")));
monthDdList.SelectByText("January");
monthDdList.SelectByText("February");