public void TestLoginRefactor2() { var username = "******"; var password = "******"; var mainPage = new MainPage(browser); var loginPage = new LoginPage(browser); mainPage.NavTo(); mainPage.linkLogOn().Click(); loginPage.txtUsername().SendKeys(username); loginPage.txtPassword().SendKeys(password); loginPage.btnLogOn().Click(); //string foundUser = mainPage.strWelcomeUserText().Text; string foundUser = mainPage.LoggedInUser(); var loginSuccess = username.Equals(foundUser); Assert.True(loginSuccess); //Assert.IsTrue(username.Equals(foundUser),"expected user name didn't match found"); }