在 Safari 浏览器上,我需要从下拉列表中选择一个选项。下面的代码适用于除 Mac OS 上的 Safari 之外的所有浏览器。我使用 Safari 10.1.1 和 selenium web 驱动程序版本 3.3.1 我已经用 Java 编写了代码。请参考下面的代码 -
webElement = findElement(field);
if (webElement.isDisplayed())
{
Select select = new Select(webElement);
select.selectByVisibleText(value);
}
Run Code Online (Sandbox Code Playgroud)