I am getting error while trying to open link , below is code , Object reference not set to an instance of an object.' | Selenium C# Forum
Sivaramaraju Danthuluri Posted on 03/07/2020


using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace seleniumproject1
class Facebook
static void Main(string[] args)


string browser = "Mozilla";
IWebDriver driver = null;

if (browser.Equals("Mozilla"))
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\seleniumWT\softwares\geckodriver-v0.26.0-win32", "geckodriver.exe");
service.FirefoxBinaryPath = @"C:\Program Files\Mozilla Firefox\firefox.exe";
FirefoxDriver fd = new FirefoxDriver(service);
driver.Url = "http://facebook.com";

else if (browser.Equals("IE"))
InternetExplorerDriver ie = new InternetExplorerDriver();