Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.1k views
by Contributing Tester (14 points)
retagged by
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();
by Contributing Tester (14 points)
i used geckodriver v0.18.0
by The go-to Tester (181 points)
can you give stacktrace or error message?
by Contributing Tester (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
by Contributing Tester (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 like 0 dislike
by The go-to Tester (181 points)

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!

by Contributing Tester (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
by The go-to Tester (181 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();
by Contributing Tester (14 points)
i tried with above code but not working,getting same error
by The go-to Tester (181 points)
Uninstall and install 32-bit Firefox. It should be installed inside C:\Program file (x86) folder


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...