Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

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

Open 1 Answers 87 Views
0 1
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 by (14 points)
i used geckodriver v0.18.0
commented by (192 points)
can you give stacktrace or error message?
commented by (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 by (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
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 by (192 points)
4Comments
commented by (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 by (192 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 by (14 points)
i tried with above code but not working,getting same error
commented by (192 points)
Uninstall and install 32-bit Firefox. It should be installed inside C:\Program file (x86) folder

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors

...