如何使用 xpath 使用 selenium java webdriver 从下拉列表中选择一个值? 根据下拉列表中选择的选项,会出现字段,因此我不需要在其中输入值。我的问题是,在下拉列表中选择选项后,我没有获取字段。经过很长一段时间后,它出现,意味着出现错误
最佳答案
您可以单击下拉菜单并等待显示选项,然后您可以单击其中的选项。
或
Select select = new Select(driver.findElement(By.id("drop_down_id")));
select.selectByIndex(`index_value_of_option`);
关于java - 使用 selenium java webdriver 从下拉列表中选择一个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17922390/