title: Exception in thread "main" java.lang.Error:Unresolved compilation problems: working with selenium
body: <p>I am a begineer in selenium and trying my own after installation of eclipse, java, selenium, TestNg and started writing the below code.</p>
  <blockquote>
  <p>Exception in thread &quot;main&quot; java.lang.Error: Unresolved compilation problems:</p>
  <p>WebDriver cannot be resolved to a type</p>
  <p>FirefoxDriver cannot be resolved to a type</p>
  <p>at Mypackage.MyClass.main(MyClass.java:8)</p>
  </blockquote>
  <pre><code>package Mypackage;
  
  public class MyClass {
  
      public static void main(String[] args) {
          
          WebDriver driver = new FirefoxDriver();
          String baseUrl = &quot;http://google.com&quot;;
          String expectedTitle = &quot;Welcome: Hello&quot;;
          String actualTitle = &quot;&quot;;
          driver.get(baseUrl);        
          actualTitle = driver.getTitle();
  
          if (actualTitle.contentEquals(expectedTitle)) {
              System.out.println(&quot;Test Passed!&quot;);
          } else {
              System.out.println(&quot;Test Failed&quot;);
          }
          driver.close();
      }
  }
  </code></pre>