I tried to provide my Selenium Webdriver test with all needed drivers in a separate folder under the src.
I tried to create a new instance of the webdriver like this:
System.setProperty("webdriver.ie.driver", "pathToTheFFDriver");
WebDriver driver = new FirefoxDriver();
The problem is now to create a proper path to the driver. When I copied the driver to somewhere outside of the project, e.g. "C:\drivers\geckodriver.exe" I can create a working path. But how can I access the file without copying it first?
I tried the following:
System.setProperty("Webdriver.gecko.driver", "driver/geckodriver.exe");
System.setProperty("Webdriver.gecko.driver", "./driver/geckodriver.exe");
System.setProperty("Webdriver.gecko.driver", "./src/driver/geckodriver.exe");
But I always get the same error
The path to the driver executable must be set by the webdriver.gecko.driver system property;
What am I missing? How can I access the driver directly without copying it first?