Selenium WebDriver and DropDown Boxes

前端 未结 10 1765
星月不相逢
星月不相逢 2020-11-29 00:16

If I want to select an option of a dropdown box, there are several ways to do that. I always used:

driver.findElem         


        
10条回答
  •  猫巷女王i
    2020-11-29 01:07

    You could try this:

    IWebElement dropDownListBox = driver.findElement(By.Id("selection"));
    SelectElement clickThis = new SelectElement(dropDownListBox);
    clickThis.SelectByText("Germany");
    

提交回复
热议问题