0
getting geckodriver error in visual studio 2017,Selenium 3.4.0 c#

Open 1 Answers 23 Views
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\SeleniumDrivers\geckodriver.exe");
            service.FirefoxBinaryPath= @"C:\Program Files\Mozilla Firefox\firefox.exe";
            driver = new FirefoxDriver();
            baseURL = "http://oasis-test:9998/#/login";
            verificationErrors = new StringBuilder();
4Comments
commented Jul 18 by sandeep1178 (14 points)
i used geckodriver v0.18.0
commented Jul 18 by stbadmin (4,912 points)
can you give stacktrace or error message?
commented Jul 18 by sandeep1178 (14 points)
Message: OpenQA.Selenium.DriverServiceNotFoundException : The file C:\SeleniumDrivers\geckodriver.exe\geckodriver.exe does not exist. The driver can be downloaded at https://github.com/mozilla/geckodriver/releases
commented Jul 18 by sandeep1178 (14 points)
Test Name:    TheEnviTest
Test FullName:    SeleniumTests.Envitest.TheEnviTest
Test Source:    C:\Users\hi\Documents\Visual Studio 2017\Projects\EnviTest\EnviTest\UnitTest1.cs : line 32
Test Outcome:    Failed
Test Duration:    0:00:00.016

Result StackTrace:   
at OpenQA.Selenium.DriverService..ctor(String servicePath, Int32 port, String driverServiceExecutableName, Uri driverServiceDownloadUrl) in c:\Projects\webdriver\dotnet\src\webdriver\DriverService.cs:line 65
   at OpenQA.Selenium.Firefox.FirefoxDriverService.CreateDefaultService(String driverPath) in c:\Projects\webdriver\dotnet\src\webdriver\Firefox\FirefoxDriverService.cs:line 169
   at SeleniumTests.Envitest.SetupTest() in C:\Users\hi\Documents\Visual Studio 2017\Projects\EnviTest\EnviTest\UnitTest1.cs:line 23
Result Message:    OpenQA.Selenium.DriverServiceNotFoundException : The file C:\SeleniumDrivers\geckodriver.exe\geckodriver.exe does not exist. The driver can be downloaded at https://github.com/mozilla/geckodriver/releases

1 Answer

0

So, as the message says, you have to give only path to the geckodriver.exe, you do not have to mention the geckodriver.exe file name.

Your code should look like,

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\SeleniumDrivers");
service.FirefoxBinaryPath= @"C:\Program Files\Mozilla Firefox\firefox.exe";
driver = new FirefoxDriver();
baseURL = "http://oasis-test:9998/#/login";
verificationErrors = new StringBuilder();
 

Hope that helps!

answered Jul 18 by stbadmin (4,912 points)
4Comments
commented Jul 18 by sandeep1178 (14 points)
Now getting this error

Message: OpenQA.Selenium.WebDriverException : FireFox executable listed in the registry does not exist, please make sure you have installed FireFox correctly
commented Jul 18 by stbadmin (4,912 points)
okay this error comes when your Firefox is not correctly installed. Make sure that Firefox browser which you have mentioned in the code C:\Program Files\Mozilla Firefox\firefox.exe is on the right path.

Or you can simply remove the mention of binary. You can write your code like:

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\SeleniumDrivers");
driver = new FirefoxDriver();
baseURL = "http://oasis-test:9998/#/login";
verificationErrors = new StringBuilder();
commented Jul 18 by sandeep1178 (14 points)
i tried with above code but not working,getting same error
commented Jul 18 by stbadmin (4,912 points)
Uninstall and install 32-bit Firefox. It should be installed inside C:\Program file (x86) folder
...