I'm trying to set up selenium tests in nCrunch which outputs the tests to its own temp folder.
I'm getting the following error when I create the driver (new PhantomJSDriver()
):
OpenQA.Selenium.DriverServiceNotFoundException : The PhantomJS.exe file does not exist in the current directory or in a directory on the PATH environment variable.
However I have checked and PhantomJS.exe
does exist in the current directory (\bin\debug).
I then tried using new PhantomJSDriver(".\\")
which should be the current directory and that does work.
What is the "current directory" Selenium is referring to in this message?
Rather than assuming ".\\"
, get the current working working directory by Directory.GetCurrentDirectory
or System.AppDomain.CurrentDomain.BaseDirectory
. Take a look at Get current folder path.
new PhantomJSDriver() will use your bin folder
if PhantomJS.exe does not exist there, try to find where it's located and insert full path in constructor
new PhantomJSDriver("real_path_to_PhantomJS.exe")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With