Opening a browser | Selenium Webdriver Tutorial with c# |Selenium C# training
10% May Month Discount Avail now

Selenium C# Training Forum

opening a browser

mai Post on 29/11/2018


When setting up the browser:

All tutorials show this:

Method #1:

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\selenium""geckodriver.exe");
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
driver = new FirefoxDriver();

Actually when I do

Method #2:
driver = new FirefoxDriver();

Method #2 is what I used and it works fine. Is there any reason to use Method#1 ? I have the latest firefox installed on my machine




gunjan Reply on 01/12/2018

If you have set the path of geckodriver.exe in the environment variable, then there is no need of passing the path in the code. So , then if you do it by Method2 , then that is also correct and there is no need of using the Method1.