Home » Software Testing » Automation Testing » Selenium WebDriver Tutorial » How to launch Selenium Script in Safari Browser Using SafariDriver?

How to launch Selenium Script in Safari Browser Using SafariDriver?

Previously SafariDriver was supporting Safari browser on Windows machine but recently Apple has decided to remove its support for windows and then executions on safari has become the job of Mac machine. So for the same, we need a mac machine where safari browser should be installed. But if you want to learn how to launch chrome in Selenium then read this post
Installing Chromedriver on MAC
and for windows. Read this post
Launch Chrome Browser Using WebDriver

So let’s get back to the topic, Safari driver has been implemented as a plugin in the safari browser and this provides a perfect match of client and server machine where SafariDriverServer acts as a server and Selenium-Java/Language binding acts as a client.


So for the same, we need to download the plugin and it needs to be installed on Safari browser and once plugin installed on Safari everything is set and you can write a script for a safari like any other browser by calling the

[the_ad_placement id=”incontent”]So before moving ahead let see the steps to perform these actions.

1- Go to http://selenium.dev

2- Go to Download  and Navigate to Browser Section

3- Again navigate to “Safari” heading and click on documentation link to find the detail of safaridriver.

4- Now click on the hyperlink beside “Latest Release”

5- It will download the plugin and double click on downloaded file and it will open the extension installation screen. Click on “Trust ” button and it will install it in the browser and by default, it will check WebDriver checkbox.

6- Go to your eclipse and write scripts and it will work like any other browser on Mac machine

For better understanding watch video once and if still, you have some doubt then please share your feedback.

1 thought on “How to launch Selenium Script in Safari Browser Using SafariDriver?”

  1. Hi ,
    I have done same steps as mentioned by you. But safari browser is not launching, its shown null pointer exception. I have installed safari extension in safari. I have checked that webdriver extension is also enabled. I have selenium server 3.1.0 in my classpath. Following the code:

    System.setProperty(“webdriver.safari.driver”, “./lib/SafariDriver.safariextz”);
    driver = new SafariDriver();
    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    return driver;

    at pouringPounds.browserFunction.DriverFunctions.openURL(DriverFunctions.java:79)
    at pouringPounds.testCases.testClass.test1(testClass.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:756)
    at org.testng.TestRunner.run(TestRunner.java:610)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
    at org.testng.TestNG.runSuites(TestNG.java:1133)
    at org.testng.TestNG.run(TestNG.java:1104)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
%d bloggers like this: