Do you have questions ? We got the answers!

Ask a question:

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

Open 1 Answers 56 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,970 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,970 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,970 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,970 points)
Uninstall and install 32-bit Firefox. It should be installed inside C:\Program file (x86) folder

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 430 pointsSunilBhaskar

    40 questions 14 answers26 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 342 pointssumitkumarwatts

    0 questions 12 answers0 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments

...