Selenium Webdriver Instantiation in Selenium(3.7.x)

In latest selenium 3.7.x version, most of the drivers (Chrome, Firefox, IE, Safari) are deprecated; in the next release of selenium will remove those driver instantiation logic. Following are the new way of driver instantiation in selenium 3.7.x:
For Internet Explorer:
WebDriver driver;
System.setProperty(“”, <path to IEDriverServer>);
InternetExplorerDriverService ieservice= new InternetExplorerDriverService.Builder().build();
driver = new InternetExplorerDriver(ieservice);
For Chrome:
WebDriver driver;
System.setProperty(“”, <path to chromedriver>);
ChromeDriverService chromeservice= new ChromeDriverService.Builder().build();
driver = new ChromeDriver(chromeservice);
For Firefox:
WebDriver driver;
System.setProperty(“webdriver.gecko.driver”, <path to geckodriver>);
GeckoDriverService geckoservice= new GeckoDriverService.Builder().build();
driver = new FirefoxDriver(geckoservice);
For Safari (on MAC)
WebDriver driver;
SafariOptions options = new SafariOptions();
driver = new SafariDriver(options);
Happy Automation Testing !
Make it perfect !


SafariDriver, Safari 10 for desktop web automation

About SafariDriver

The SafariDriver is implemented as a Safari browser extension. The driver inverts the traditional client/server relationship and communicates with the WebDriver client using WebSockets.

Apple’s decision to drop Safari on Windows

The SafariDriver requires Safari 5.1+. Consequently, SafariDriver on Windows will most likely not work on newer versions of Safari and/or Windows because of Apple’s decision to drop Safari on Windows. Apple apparently kills Windows PC support in Safari 6.0

Safari 10 for desktop web automation

Need to do following set up before starting the execution:

  1. Ensure that the Develop menu is available. It can be turned on by opening Safari preferences (Safari > Preferences in the menu bar), going to the Advanced tab, and ensuring that the Show Develop menu in menu bar checkbox is checked.
  2. Enable Remote Automation in the Develop menu. This is toggled via Develop > Allow Remote Automation in the menu bar.

NOTE: Sometime you may face Unable to start the server: another safaridriver is already running. You can resolve this problem by running following command via terminal,

> launchctl list | grep webdriverd

> sudo kill xxxx

where xxxx is the process id of the webdriverd process. Which it looks like you may already have tried.

ServerSocket socket;

try {

socket = new ServerSocket(0);


port = socket.getLocalPort();


} catch (IOException e) {


SafariOptions options = new SafariOptions();



driver = new SafariDriver(options);