There's my class that uses Selenium WebDriver and throws the error.
public class Test_Chromedriver {
public static WebDriver driver;
public static void main(String[] args) {
try {
System.setProperty("webdriver.chrome.driver","E:\\jars\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.facebook.com");
driver.findElement(By.id("email")).sendKeys("surya");
driver.findElement(By.name("pass")).sendKeys("hello");
} catch (Exception e) {
e.printStackTrace();
}
finally{
driver.close();
driver.quit();
}
}
}
once i ran the above code below Error Message is getting:
Started ChromeDriver
port=12877
version=23.0.1240.0
log=D:\Eclipse Juno Workspace\AS Selenium workspace\WebDriver Applications\chromedriver.log
Exception in thread "main" java.lang.NullPointerException
at Test_Chromedriver.main(Test_Chromedriver.java:25)
Note: webdriver opening the chrome browser then entering the values into the fields, but above error is getting displayed all the times in console and finally block also not executing.