2016-11-30 3 views

答えて

1

どのようにドロップダウンリストの値を選択するには?

実際にはターゲット要素が正しくない<select>要素です。したがって、Selectクラスを使用して処理することはできません。

次のようにしてみてください -

driver.get("http://demos.telerik.com/aspnet-ajax/dropdownlist/examples/overview/defaultcs.aspx"); 
driver.manage().window().maximize(); 

WebDriverWait wait = new WebDriverWait(driver, 60); 

//This line would find the dropdown element and open the options 
wait.until(ExpectedConditions.elementToBeClickable(By.id("ctl00_ContentPlaceholder1_RadDropDownProducts"))).click(); 

//This line would select the desire option using their text 
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//li[text() = 'Chai']"))).click(); 
関連する問題