首页 > 技术文章 > Selenium Java Selection的使用

woniu123 2017-03-08 14:25 原文

用于向具有drop-down的选择框中输入内容

new Select(new ChromeDriver().findElement(By.cssSelector(" 。。。"))).selectByIndex(。。。);

new Select(new ChromeDriver().findElement(By.cssSelector(" 。。。"))).selectByValue(。。。);

new Select(new ChromeDriver().findElement(By.cssSelector(" 。。。"))).selectByVisibleText(。。。);

new Select(element).selectByVisibleText(str);

推荐阅读