简体   繁体   中英

Select a second dropdown menu

I can add a second dorpdownmenu to select

an error says that it is already defined a variable of selectElement

how can I add a 2 select dropdown menu

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

if you mean how to work with 2 select objects:

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

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

if you mean how to select several items in DDList:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM