Using the Selenium WebDriver - Unable to launch chrome browser on Mac

While working with Selenium webdriver, we may be unable to launch the Chrome browser on Mac. However, it can be avoided by following the steps listed below −

Step1 − Navigate to the link: and click on the download link of the chromedriver version which is compatible with our local chrome browser.

Step2 − Click on the chromedriver link available for the Mac operating system.

Step3 − Once the download of the zip file gets completed, unzip it to get the chromedriver.exe file. Save it to a desired location.

Step4 − While mentioning the path of the chromedriver.exe file in the System.setProperty method, we can mention only chromedriver instead of chromedriver.exe.

Code Implementation

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.concurrent.TimeUnit;
public class FirstAssign {
   public static void main(String[] args) {
      //configure path of chromedriver.exe
      System.setProperty("", "chromedriver");
      //ChromeDriver instance
      WebDriver driver = new ChromeDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //url launch
      System.out.println("Page title: "+ driver.getTitle());
      //browser quit