To run selenium version 3.0  or above we need Selenium gecko driver setup to run Firefox in Ubuntu or Windows.
Download the gecko driver from the following link.

Extract the geckodriver from the zip and place in directory.

Copy and paste the code after importing  the external jar files of java selenium web driver.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
public class MyClass {
public static void main(String[] args) {
//Create a new instance of Firefox Browser
System.setProperty(“webdriver.gecko.driver”,”/home/shakti/Downloads/geckodriver”);

WebDriver driver = new FirefoxDriver();

}
}

Leave a Reply

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