0

I am receiving this exception:

Test method OnlineBankingTests.ConnectNativeSmokeTest.CNLoginTests.VerifyLoginNoBlankPwd threw exception: System.NullReferenceException: Object reference not set to an instance of an object. Stack Trace: CNLoginPage.PasswordRequired() line 577 CNLoginTests.VerifyLoginNoBlankPwd() line 78

But, to me it looks like the object is referenced... I am a little lost.

    [TestMethod]
    [TestCategory("CNSmoke")]
    public void VerifyLoginNoBlankPwd()
    {
        CanRun();

        // Arrange
        var baseUrl = Settings.ConnectNativeURL;

        var loginPage = new CNLoginPage(ConnectNativeDriver); // Isnt it creating a reference here to the class that contains the PasswordRequired() method??

        // Verify Password is Required
        loginPage.GoTo(baseUrl);
        loginPage.PasswordRequired(); // Line 78
        Assert.IsTrue(
            loginPage.IsBlankPasswordErrorSuccessful(),
            "Leaving Password blank didn't produce expected error.");
    }

public class CNLoginPage
{

    public void PasswordRequired()
    {
        var userId = _driver.GetElementByCssSelector("#username");
        userId.SendKeys("TESTER"); // Line 577

        var password = _driver.GetElementByCssSelector("#password");
        password.SendKeys(" ");

        var enter = _driver.GetElementByCssSelector("#AutomatedTesting-loginButton");
        enter.Click();
    }

}
Kody Berry
  • 111
  • 1
  • 7

0 Answers0