I created a testing project and set an environment variable. Then run the project and it could not find the chromedriver. Then I set a path inside the project to the chromedriver. It worked.

The problem occurs when I set an environment variable only.

I tried setting the path in Windows 7 and no problem occurred. Is there any special method to set an environment variable in windows 10. I tried several tutorials too.

Any suggestions to make this work?

  • What tool are you using? You probably need to set path to chromedriver manually. – Mate Mrše Nov 2 '18 at 13:40
  • I see no code at all. How are you setting the environment variable(s)? – Bill Hileman Nov 2 '18 at 18:06
  • I tried setting path manually. It works. Problem occurs when environment variable is set – Joe Nov 5 '18 at 6:25
  • If you are using an IntelliJ IDEA or something similar then you need to set it in the IDE. It is a sad truth of using these high-level tools. – Saša Zejnilović Nov 6 '18 at 9:45

Why not use an API that downloads the Webdriver, sets the environment variables and removes the issue of updating the path if the project is shared on another computer/server? This would do : https://github.com/bonigarcia/webdrivermanager

  • I would refrain from getting deep in another huge dependency. I always managed my drivers with PATH and a symlink to the current driver (+ alias or two to change symlinks). – Saša Zejnilović Nov 6 '18 at 10:00

I have also faced similar issue with Window 10. In Window 10 with intelliJ I found that for System.getProperty("user.dir") it comes with backslash. i.e c:\user\qa

I resolved it by replacing backslash with forward slash like below

String chromePath= System.getProperty("user.dir").replaceAll("\\\\","/") + "/src/driver/chromedriver.exe

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.