0

I am using selenium FirefoxDriver, and need to configure the driver:

System.setProperty("webdriver.gecko.driver", "path_to_driver");

The problem is that when I try run the jar withouth the IDE, I get a error, because it can not access my driver (which is inside the jar) from the outside

I have a week now, every kind of help is welcome.

Adama Camara
  • 165
  • 2
  • 9

1 Answers1

1

Unfortunately, you cannot refer to a resource within a jar file the same way as you would from your IDE. A similar question has been answered here

Alternative

You can try WebDriver Binary Downloader which will automatically download and configure the latest driver binary for you.

There's no need to explicitly define the path or even have the binary in your project.

WebDriverBinaryDownloader.create().downloadLatestBinaryAndConfigure(BrowserType.FIREFOX);

WebDriver driver = new FirefoxDriver();
  • I just created a temp file and read it. But damn had no idea WebDriver Binary Downloader existed, will defiantly try it out. – Adama Camara Mar 20 '18 at 09:58