Search code examples
javaeclipseseleniumpathworking-directory

"java.lang.IllegalStateException: The driver executable does not exist" reports odd appended path


A colleague of mine is using Eclipse Photon on Windows 10. When they specify the ChromeDriver location to run a Selenium test, they get an error like:

java.lang.IllegalStateException: The driver executable does not exist: C:\eclipse-project-folder\?C:\some-path\chromedriver.exe

...where we specified this in the VM arguments section of the run configuration:

-Dwebdriver.chrome.driver=C:\some-path\chromedriver.exe

In particular, the ? gets my attention. We've tried putting chromedriver.exe in a couple of places, each of them in paths without spaces, but it always ends up with this kind of appended path in the error. Is there something we're missing in terms of configuration or something?

As an alternative, we specified a system environment variable for chromedriver.exe and added it to the Windows Path variable, but it didn't recognize that either, asking us to specify the webdriver.chrome.driver property as usual.


Solution

  • I was able to reproduce the issue by placing ? before the driver path. But I am sure you might have checked this. Just try to copy paste the path to the notepad and then take it from there when you are working with the paths, by this way you don't end-up appending some invisible chars that might cause this kinds of issues.

    enter image description here

    If you update the system environment variable any time, make sure to restart the system. So that the variables are up to date.