How to setup Selenium & Gecko driver on MAC

Step 1. Install Selenium

Create a maven project and add dependency for Selenium. To get maven details open This will list down all selenium related repositories. Select selenium java and select latest version. You can find the maven details like:

<!– –>

Step 2. Install Gecko driver

Download mac os specific GeckoDriver executable. This will download the tar file. unzip it to get the geckodriver unix executable. Copy this file into your project lib folder. Open the terminal and run command
chmod +x gecko driver

Here is sample code to test:

// Open Browser
			System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+ "/lib/geckodriver");
			System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+ "/lib/geckodriver.exe");
		_driver = new FirefoxDriver();

Leave a Reply

Your email address will not be published. Required fields are marked *