0

I am trying to export my project as a runnable jar and run it without driver.exe files being present. I tried incorporating them with below code to make it independent but still unable to run the jar file without driver files being presenting in the same folder.

code:

String currentDir=System.getProperty("user.dir");

System.setProperty("webdriver.chrome.driver", currentDir+File.separator+"chromedriver.exe");

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

You can use WebDriverManager for this purpose:

You can download the dependency by Gradle:

dependencies {
    testCompile("io.github.bonigarcia:webdrivermanager:3.6.1")
}

Then on the code, you just need to setup the driver and create the driver objects:

WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();

You can find details about driver version here.

  • Thank you so much. Worked like a charm!!! :) – Venky Jun 24 at 4:47
  • Most welcome. Could you mark the answer as accepted? – João Farias Jun 24 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.