I have test:
@Test
public void postStatusTest() {
loginPage.logInFacebook("my-email", "my-password");
facebookMainPage.checkNotifications();
facebookMainPage.postStatus("Test");
}
where:
public FacebookMainPage checkNotifications(){
if (driver.findElements(notificationsButton).size() > 0) driver.findElement(notificationButton).click();
return new FacebookMainPage(driver);
}
and:
public FacebookMainPage postStatus(String statusText){
driver.findElement(textField).click();
driver.findElement(textField).sendKeys(statusText);
driver.findElement(postButton).click();
return new FacebookMainPage(driver);
}
can you, please, explain why in my case both methods checkNotifications
and postStatus
return NullPointerException
? I've read theory, but I hardly understand what in my case can be wrong.