Selenium SafariDriver
The SafariDriver is the link between your Selenium tests and the Safari Browser. We use the SafariDriver to implement the WebDriver in the Safari Browser. The Safari Browser provides the implementation of the SafariDriver as a plugin. Here, SafariDriverServer acts as the server, and Selenium-Java/Language binding acts as the client providing a suitable match for the client and server machine.
Configuration
Setting up to run tests using the SafariDriver(v10 and above) is very simple on an Apple Mac system. You can find the Safari driver in the following path on your system: /usr/bin/safaridriver because Safari now provides native support for the WebDriver API. If you do not have a Mac machine, you can use cloud-based tools to access Safari in a local system.
Before performing automation testing on Safari, you must enable the Remote Automation feature from the developer menu. You can achieve that by using the Allow Remote Automation button in the Safari Develop menu.

Implementation
Now that you have configured SafariDriver for your system, you can write a test case and run it using the Safari browser.
We will use the Eclipse IDE to run our Java Selenium test case on Safari using the SafariDriver. Our test case should open Google Chrome, go to www.google.com, and enter Coding Ninjas in the search box. The test code looks something like this.
Program
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
public class SafariTest {
public static void main(String[] args) {
// Instantiate a SafariDriver class.
WebDriver driver = new SafariDriver();
driver.manage().window().maximize();
// Launchs the Website
driver.navigate().to("http://www.google.com/");
// Clicks on the search text box and sends value
driver.findElement(By.name("q")).sendKeys("CodingNinjas");
// Click on the search button
driver.findElement(By.name("btnK")).sendKeys(Keys.ENTER);
}
}

You can also try this code with Online Java Compiler
Run Code
Output

Selenium IE Driver
The Selenium Internet Explorer Driver is a stand-alone server that acts as a link between Selenium tests and Internet Explorer. It is a stand-alone server implementing the WebDriver protocol on IE.
Configuration
Firstly you will need to download the InternetExplorerDriver executable file according to your system requirements. You can download InternetExplorerDriver for your respective operating system from here. After unzipping the downloaded file, you will get the executable file(IEDriverServer.exe).
You will also need to add the executable file to your path for it to run correctly. You can check out how to add an executable to the path for both Windows and Mac by following the configuration steps from our article on Running Selenium Tests on Google Chrome(<--link to be added–>).
Implementation
Now that you have configured InternetExplorerDriver for your system, you can write a test case and run it using the IE browser.
We will use the Eclipse IDE to run our Java Selenium test case on Safari using the SafariDriver. Our test case should open Google Chrome, go to www.google.com, and enter Coding Ninjas in the search box. The test code looks something like this.
Program
package chromeselenium;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class IETest {
@SuppressWarnings("deprecation")
public static void main(String[] args) {
//Setting system properties of InternetExplorerDriver
System.setProperty("webdriver.ie.driver", "D:IE Driver ServerIEDriverServer.exe");
//Creating an object of InternetExplorerDriver
WebDriver driver=new InternetExplorerDriver();
driver.manage().window().maximize();
//Deleting all the cookies
driver.manage().deleteAllCookies();
//Specifiying pageLoadTimeout and Implicit wait
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
//launching the specified URL
driver.get("https://www.google.com/");
//Locating the elements using name locator for the text box
driver.findElement(By.name("q")).sendKeys("CodingNinjas");
//Click on the search button
driver.findElement(By.name("btnK")).sendKeys(Keys.ENTER);
}
}

You can also try this code with Online Java Compiler
Run Code
Running this code on a Windows machine with the compatible IE browser should give the same output on the IE browser as the output on the Safari browser above.
FAQs
1. How do I install Safari drivers on my Mac?
Ans: Mac devices now provide native support for automation testing. You can not install the SafariDriver manually on your Mac device. If you can not find it in /usr/path/safaridriver, you should update your Safari browser to v10 or above.
You may also need to run /usr/path/safaridriver – enable on your terminal if you update from older Mac OS to High Sierra or above.
2. What is WebDriverManager Selenium?
Ans: The WebDriverManager automates the browser set up in your Selenium test code. The WebDriverManager downloads the latest version of the browser driver binary and the binary for the appropriate platform by default.
3. What is WebDriver interface selenium?
Ans: WebDriver is a remote control interface that enables you to introspect and control user agents or browsers. The methods in the WebDriver interface fall into three types:
- Control of the browser
- Selection of the WebElements
- Debugging aids
4. What is the driver get in Selenium?
Ans: You can use the driver. get() method to open an URL and load the whole page. The WebDriver waits until the page loads completely before returning control to your test or script.
Key Takeaways
This article extensively discussed the SafariDriver and IEDriver and their implementation in Selenium tests using Java. The Safari browser is a highly prominent web browser, making performing web tests vital for web developers and QAs. And even though IE does not have a large user base, as a web tester, you must not leave any potential customers. So knowing how to perform Selenium tests on both Safari and IE can be handy.
We hope that this blog has helped you enhance your knowledge regarding Selenium. If you would like to learn more, check out our articles on Selenium Interview Questions, Methods in Selenium, and Basics of Java. Do upvote our blog to help other ninjas grow. Happy Coding!