Dropdown not getting selected using Selenium Webdriver on Safari browser 10 in Mac

Viewed 3089

On Safari browser I need to select an Option from the dropdown. below code works for all the browsers except for Safari on Mac OS. I am using Safari 10.1.1 with selenium web driver version 3.3.1 I have written the code in Java. Refer the code below -

webElement = findElement(field);
if (webElement.isDisplayed())
{
  Select select = new Select(webElement);
  select.selectByVisibleText(value);
}
4 Answers

Select is not working on Sierra 10,12.6 safari 11.0 I tried the below and they do not work as nothing happen and no error shown.

selectByIndex(3) 
selectByValue("value"), 
selectByVisibleText("Yes");

If you try to use : Send key method then the select option is populated.

None of the dropdown select functions work in Safari. As a workaround I have used element.type("") in Selenium and it worked in place of Select.

Related