1

TestFixture:

class TestForFirefox
{
    IWebDriver driver = null;
    [SetUp]
    public void Initialize()
    {
        this.driver = new FirefoxDriver();
    }
    [Test]
    public void OpenAppTest()
    {
        driver.Navigate().GoToUrl("http://www.demoqa.com");
    }
    [TearDown]
    public void CloseApp()
    {
        driver.Quit();
        driver.Dispose();
    }
}

Packages I have installed:

  1. NUnit 2.6.4
  2. NUnit Test Adapter 2.0.0
  3. Selenium Firefox Webdriver 0.11.1
  4. Selenium Support 2.53.1
  5. Selenium Webdriver 2.53.1

My OS: Windows 10 and Firefox Ver: 48.0.2

While running this code it shows: object reference not set to an instance of an object.

  • Did you import this Firefox driver? Did you configure it before using it? – Yu Zhang Feb 1 '17 at 6:42
  • Yes i have imported Firefox. – Dark Matter Feb 1 '17 at 8:22
  • I have used using OpenQA.Selenium.Firefox; – Dark Matter Feb 1 '17 at 8:22
2

Selenium 2.53.1 is not supported in Firefox 48, you will need to downgrade to Firefox 47 or use the Geckodriver instead.

https://stackoverflow.com/questions/38930370/selenium-2-53-or-2-48-not-working-in-firefox-48-0

0

Change the top part of your code:

public static IWebDriver Driver { get; set; }
[SetUp]
public void Initialize()
{
    Driver = new FirefDriverDriver()
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.