Hi getText methoid is returning nothing when i try to read Sign In Failed Invalid login credentials while using cucumber BDD in selenium

0 votes
Hi I am using "Edureka" login for practice , when i am trying to read message "

"Sign In Failed. Invalid login credentials" by using getText() method , its showing no results.

Please find the logs:

Expected: a string containing "Sign In Failed. Invalid login credentials"

     but: was ""

at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)

at stepDefs.testSteps.validate_password_error(testSteps.java:62)

at ✽.Validate password error(file:///C:/Users/jyoti/eclipse-workspace/EdurekaWebsite/src/test/java/resources/Login.feature:16)

@FindBy(xpath="//p[@id='passwdErrorr']")

WebElement PasswordError;

public String verifyPassErrMesssage()

{

return PasswordError.getAttribute("innerText");

}

@Then("Validate password error")
public void validate_password_error() {
    String Message = homepage.verifyPassErrMesssage();
    System.out.println("Message is" + Message);
    assertThat(Message, containsString("Sign In Failed. Invalid login credentials"));
    //Assert.assertEquals("Sign In Failed. Invalid login credentials.", Message);
    driver.close();
}
Feb 18, 2021 in Selenium by Jyoti

edited Mar 4 19 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP