📜  selenium 获取下拉文本 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:02.357000             🧑  作者: Mango

代码示例1
Select select = new Select(driver.findElement(By.xpath("//select")));
WebElement option = select.getFirstSelectedOption();
String defaultItem = option.getText();
System.out.println(defaultItem );