title: How to get PhantomJSDriver to work in selenium?
body: <p>I am trying to use the <code>PhantomJSDriver</code>. The code below works with
  <code>FirefoxDriver</code> but will not work with PhantomJSDriver. The error is:</p>
  
  <blockquote>
    <p>[ERROR - 2016-02-12T16:02:47.717Z] WebElementLocator -
    _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1455292967683 org.openqa.selenium.NoSuchElementException: Error
    Message => 'Unable to find element with id 'email''</p>
  </blockquote>
  
  <p>Is there any clear guides on how to do this in Java, or can anyone get this working to login? I'm struggling to find some clarity on this topic.</p>
  
  <p>I'm assuming the error is something to do  with the browser being headless which therefore messes up with the paths but I have seen others using similar code and it works for them.</p>
  
  <pre><code>WebDriver driver = new PhantomJSDriver();
  try {
      System.out.println("Logging in to Facebook...");
  
      driver.get("https://www.facebook.com/login");
      System.out.println(driver.getTitle());
  
      driver.findElement(By.id("email")).sendKeys("USERNAME");
      driver.findElement(By.id("pass")).sendKeys("PASS");
      driver.findElement(By.id("loginbutton")).click();
  }
  catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>