Created base class:
public loginpage() {
PageFactory.initElements(driver,this);
}
Then page objects initialized:
public String GetTitle() {
System.out.println("title111");
return driver.getTitle();
Then created test case:
@Test
public void title() {
String a= lp.GetTitle();
System.out.println(a);
}
Output:
java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.getTitle()" because "this.driver" is null
Please let me know what's wrong.