-2

I am a new who start learning Selenium and for now using eclipse under ubuntu. But while running my first program

public class FirstTestCase {

    public static void main(String[] args) throws InterruptedException {
        // TODO Auto-generated method stub

        // Create a new instance of the Firefox driver
        WebDriver driver = new FirefoxDriver();

        //Launch the Website
        driver.get("https://www.google.com");

        // Print a Log In message to the screen
        System.out.println("Successfully opened the website https://www.google.com");

        //Wait for 5 Sec
        Thread.sleep(5);

        // Close the driver
        driver.quit();
    }
}

and I got this error and I don't know how to set the path. I just download the latest linux version of geckodriver from github and put it on my desktop. Thank you for your help

Exception in thread "main" java.lang.IllegalStateException: The path
 to the driver executable must be set by the webdriver.gecko.driver
 system property; for more information, see
 https://github.com/mozilla/geckodriver. The latest version can be
 downloaded from https://github.com/mozilla/geckodriver/releases
        at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
        at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
        at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38)
        at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91)
        at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
        at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:245)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:124)
        at automationFramework.FirstTestCase.main(FirstTestCase.java:14)
Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Nelson
  • 1

1 Answers1

0

You can set System properties with -D<name>=<value> added to command line argument.

As far as I remember you can configure this arguments by pressing small triangle next to run button.

Siva
  • 1,129
  • 1
  • 8
  • 13
talex
  • 17,973
  • 3
  • 29
  • 66