Does Selenium support Safari browser?

Yes Selenium webdriver supports Safari browser. Safari is a prominent browser and is provided by default by Apple devices. For Safari versions 10 and greater than 10, the safaridriver comes automatically and is not required to be installed separately.

The location of the SafariDriver is: /usr/bin/safaridriver. Also, it must be remembered that to work with the Safari latest version, users should have the Apple machine. This is because the Apply no longer supports Safari on Windows (from 2012).

If we are using an older version of Safari in the Apple machine, we have to turn on the webdriver support, by running the command −

/usr/bin/safaridriver −−enable

First, we have to navigate to Safari, then click on Preferences. Choose the option Advanced and check the checkbox Show Develop menu in menu bar.

Then, from the Develop menu, turn on the Allow Remote Automation option.


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.safari.SafariDriver;
import java.util.concurrent.TimeUnit;
public class LaunchSafariBrw{
   public static void main(String[] args) {
      //object of SafariDriver
      WebDriver driver = new SafariDriver();
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //launch browser
      // close browser

Updated on: 02-Feb-2021


Kickstart Your Career

Get certified by completing the course

Get Started