Do you have questions ? We got the answers!

Ask a question:

System.setProperty("webdriver.gecko.driver", ) vs adding geckodriver to PATH.

Solved 1 Answers 20 Views
We recently had an argument among my team where we brainstormed on whether to use System.setProperty("webdriver.gecko.driver", "drivers\\geckodriver-v0.18.0-win64.exe"); or setup geckodriver.exe into the PATH.

What is the ideal way?

1 Answer

Best answer
The ideal way is to add gecko driver to PATH variable. This way it will help your code be much more flexible and not dependent on any folder structure.

If you use System.setProperty, you will have to create a folder in your project path and place your driver there. You will even end up adding driver binary file to your repository management system like Git. If you update your driver, the old driver will take up space in your repository. Also, you will have to handle code for Linux and Windows differently.

So, if you simply rely on PATH, the operating system and Selenium library or server will take care of rest of the part.

I suggest you to go with PATH variable.
answered Sep 12 by SunilBhaskar (433 points)
selected Sep 12 by stbadmin

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 433 pointsSunilBhaskar

    41 questions 15 answers32 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 363 pointssumitkumarwatts

    0 questions 13 answers0 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments