0

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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
nikodaemus
  • 1,918
  • 3
  • 21
  • 32
  • Try this : `-Dwebdriver.chrome.driver=C:\\some-path\\chromedriver.exe` – KunduK Feb 20 '19 at 17:14
  • We did. We also tried putting the entire path in quotes, but that didn't work either ☹ – nikodaemus Feb 20 '19 at 18:42
  • We ultimately upgraded the ChromeDriver version and checked out the latest code and that fixed it. I'm not sure exactly what it was but it's fixed now... ??? – nikodaemus Feb 21 '19 at 15:02
  • I'm now encountering this problem with another co-worker's computer, and upgrading ChromeDriver didn't work this time... ☹ – nikodaemus Mar 28 '19 at 14:32
  • Have you tried setting the path to a variable in the shell, and then assigning to that variable? `-Dwebdriver.chrome.driver=$PATH_TO_DRIVER`? – Asyranok Mar 28 '19 at 20:06
  • Does `-Dwebdriver.chrome.driver=/C:/some-path/chromedriver.exe` (a leading `/` and forward slashes) work? – howlger Mar 30 '19 at 12:58
  • @howlger Then I get `The driver executable does not exist: C:\?C:\some-path\chromedriver.exe` – nikodaemus Apr 02 '19 at 17:39
  • This time, adding the `chromedriver` folder to the system path, restarting the computer, and removing the `-Dwebdriver.chrome.driver` from the run configuration left us with success. Perhaps the system restart was the missing link here... – nikodaemus Apr 02 '19 at 17:57
  • @skia.heliou Your code might modify the system property or set it automatically if the property is not set, e.g. `String p = "webdriver.chrome.driver"; System.setProperty(p, System.getProperty(p).replace(...));`. Anyway, good that it works now. – howlger Apr 02 '19 at 18:09
  • 3
    This issue looks to be the exact same and is related to having an invisible unicode character at the start of your path from a copy paste: [issue](https://github.com/SeleniumHQ/selenium/issues/6211). You could try retyping the path to check if this works. – cullzie Apr 02 '19 at 21:18
  • Did you try this? https://stackoverflow.com/questions/13724778/how-to-run-selenium-webdriver-test-cases-in-chrome – Perimosh Apr 03 '19 at 15:22

2 Answers2

2

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.

supputuri
  • 13,644
  • 2
  • 21
  • 39
  • 1
    Copy-pasting to Notepad (not Notepad++) helped! Invisible characters indeed. This came from the Properties window -> Security tab -> Object name – nikodaemus Apr 03 '19 at 18:41
1

Try forward slashes. It works for me.

-Dwebdriver.chrome.driver=C:/some-path/chromedriver.exe
mechnicov
  • 12,025
  • 4
  • 33
  • 56
qachang
  • 11
  • 2