My code is throwing error as “Exception in thread ”main“ java.lang.NullPointerException” while using POM class
I created a POM class as below
WebDriver driver;
By username= By.xpath("//input[@id='UEID' and @name='login']");
By password= By.xpath("//input[@class='inputtext' and @name='password']");
By Lbutton= By.xpath("//input[@class='styled-button' and @name='enter']");
By skip = By.xpath("//*[@id=\"ext-gen3\"]");
public Login(WebDriver driver)
{
this.driver=driver;
}
public void loginpage(String abc, String xyz)
{
driver.findElement(username).sendKeys(abc);
driver.findElement(password).sendKeys(xyz);
driver.findElement(Lbutton).click();
}
and the below code i am calling from my main method
Login l1=new Login(driver);
l1.loginpage("username","password");
Help me in resolving this error
Comments
Post a Comment