Please help to improve my code. I use JUnit and PageObjectPattern.
I need to:
- in area find email that contains String ("Test"), test fails if email not found
- click on this email and find there Text ("Success")
Page:
@FindBy(className = "123")
WebElement area;
@FindBy(xpath = "//*[contains(text(), 'Test')]")
WebElement email;
public String findText(){
return area.getText();
}
public void clickEmail(){
email.click();
}
Test:
@Test
public void goTest() {
home = new Home(driver);
Assert.assertTrue("Failed", home.findText().contains("Test"));
home.clickEmail();
assertTrue(home.getElement().contains("Success"));
}
I get an error: org.openqa.selenium.ElementNotVisibleException: element not visible