title: Object reference not set to an instance of an object
body: <p>When I run this program in NUnit I get an error </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object. </p>
  </blockquote>
  
  <p>Though this is not the original program I get a similar error there too. Any help appreciated. Exception occurs at </p>
  
  <pre><code>driver.Navigate().GoToUrl("http://www.yahoo.com/");
  </code></pre>
  
  <p>Program: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using NUnit.Framework;
  using OpenQA.Selenium.Firefox;
  using OpenQA.Selenium;
  
  namespace Class_and_object
  {
    [TestFixture]
    public class Class1
    {
       IWebDriver driver = null;
       [Test]
       public void test1()
       {
          class2 obj = new class2();
          driver = new FirefoxDriver();
          driver.Navigate().GoToUrl("http://www.google.com/");
          obj.method();
       }
     }
    public class class2
    {
      IWebDriver driver = null;
      public void method()
      {
          driver.Navigate().GoToUrl("http://www.yahoo.com/");
      }
    }
  }
  </code></pre>