Cannot unfocus the text field to catch the error message of empty field

Viewed 15

Screenshot
enter image description here

Below code I used, but it is not working.

public void verifyEmptyFirstName() throws InterruptedException {
    WebPageFactory.PF.firstNameTxt.clear();
    WebPageFactory.PF.firstNameTxt.sendKeys(Keys.DELETE);
    Thread.sleep(500);
    WebPageFactory.PF.firstNameEmptyErrorMSG.getText();
    System.out.println("The message should display is: "+WebPageFactory.PF.firstNameEmptyErrorMSG.getText());
}
0 Answers
Related