-3

I'm trying to run the following sample snippet

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test
{
public static void main(String[] args)
{
     WebDriver driver = new FirefoxDriver();    
      driver.get("http://www.google.com");

    //System.out.println("My new program");

}
}

When I run this code, getting the following error.

The path to the driver executable must be set by the webdriver.gecko.driver system property; Firefox version is 48.0

Could anyone please help me to fix this issue.

testing
  • 1,736
  • 15
  • 46
  • 75
  • 1
    Possible duplicate of [Fail to Launch Mozilla with selenium](http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium) – Saurabh Gaur Aug 16 '16 at 08:47

3 Answers3

1

If you are using windows follow the steps:

  1. Right click my computer and select properties.
  2. Click advanced settings->Environment variables.
  3. Under System variable there should be variable named Path.
  4. By the end of the path variable value add semi colon and then add specify your jecko driver's path. Example(C:\Jeckodriver).

Now compile the code. If it still throws exception then downgrade Firefox to 47.0.1.

Rajkumar
  • 58
  • 5
1
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test
{
    public static WebDriver driver;

    public static void main(String[] args)
    {
        System.setProperty("webdriver.gecko.driver","Browser path.exe");
        driver = new FirefoxDriver();   
        driver.get("http://www.google.com");

        //System.out.println("My new program");

    }
}
Amit Pal
  • 177
  • 3
  • 11
0

Download Gecko driver and extract to any folder. Specify gecko driver's path in path variable.

Jainish Kapadia
  • 2,603
  • 5
  • 18
  • 29
Rajkumar
  • 58
  • 5
  • i have downloaded the geckodriver-v0.10.0-arm7hf.tar and kept it in d folder. could you please tell me how to specify it – testing Aug 16 '16 at 09:27