<select class="selectCity">
<option></option>
<option value="Paris">Paris</option>
<option>New York</option>
<option>London</option>
</select>
Select op1 = new Select(driver.findElement(By.xpath("(//*[@id='cityTable']//*[contains(@class,'selectCity')])")));
List<WebElement> allSelectedOptions = op1.getAllSelectedOptions();
WebElement firstSelectedOption = op1.getFirstSelectedOption();
System.out.println("op1!!!!!"+firstSelectedOption.getText());
网页上用户选择的选项是伦敦。
把输出是op1!!!!!!
如何在网页上找到已选择的选项?
提前致谢!