How to Run Selenium Tests on Safari using SafariDriver

On This Page Running Selenium Tests on Safari using SafariDriver How to Run Selenium Te

April 20, 2026 · 3 min read · Tool Comparison

How to Run Selenium Tests on Safari habituate SafariDriver

Safari is the second well-nigh democratic browser in the macrocosm, occupying a 16 % grocery share, lay flop after Chrome. A key reason behind its significant market share is the fact that Safari is the default browser for all Apple device. Naturally, web-developers across the globe motive to ensure that their websites are thoroughly tested and optimize for all versions of Safari.

Overview

Why test in Safari?

  • Safari holds a large share on macOS/iOS devices.
  • Cross-browser reporting ensures accessibility for Apple user.

What is SafariDriver?

  • SafariDriver is a WebDriver execution for Safari.
  • It comes bundled by nonpayment with Safari 10 and supra.

How to set up?

  • Enable “ Allow Remote Automation ” in Safari Develop card.
  • Use webdriver.Safari () to initiate the driver in Selenium and run tests.

Limitations of Safari

  • Windows does not support SafariDriver.
  • Some advanced interactions may not be fully stable.

This article will discuss how to run Selenium tests on the Safari browser employ the SafariDriver.

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

Running Selenium Tests on Safari using SafariDriver

Prior to Safari automation, enable the Remote Automation feature from the developer menu. To do so, enable the Safari Developer menu first with the steps below:

  1. Go to Safari -> Preferences-> Advanced
  2. Tick mark the Checkbox with the label & # 8211;Show Develop cardin menu bar

Once done, go to the Develop carte and click on theAllow Remote Automationoption to enable it.

Once this is done, users can straightaway get started with the programming part without downloading Safari WebDriver.

This article assumes that the subscriber knows along with the required dependance or libraries. Let ’ s assume the use of for the upcoming representative.

Talk to an Expert

Let ’ s consider a simple examination scenario with three steps:

  1. Launch Safari browser
  2. Visit https: //www.google.com
  3. Enter the hunt interrogation “ BrowserStack ”
  4. Click on the hunt push
  5. Close the browser

A Java program for the above test scenario is as follows:

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; signification org.openqa.selenium.safari.SafariDriver; public class SafariDemo {public static void principal (String [] args) {// Instantiate a SafariDriver category. WebDriver driver = new SafariDriver (); // Launch Website driver.navigate () .to (`` http: //www.google.com/ ''); // Click on the search text box and send value driver.findElement (By.id (`` lst-ib '')) .sendKeys (`` BrowserStack ''); // Click on the hunting button driver.findElement (By.name (`` btnK '')) .click (); // Close the Browser driver.close ();}

Executing the above code successfully will

  1. Launch the Safari browser
  2. Navigate to Google website
  3. Enter the search query as & # 8220; BrowserStack & # 8221; and
  4. Click on the search button

Also read:

Thus, Safari automation is achieved without explicitly downloading and pertain to a specific driver practicable as in the causa of Chrome and Firefox.

Exploring critical bugs faster is only possible when exam are executed on existent device. Testing teams or individual testers can use BrowserStack ’ s for running automatize Safari tests on iOS and macOS environments in parallel. As all the browsers are installed on actual Mac and iOS devices, teams are capable to test their site in, thus place every possible bug that can show up in the website ’ s real-world usage.

Tags
20,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free