private void NavigateWithAuthentication(string baseUrl, string pageUrl) { Uri fullUrl = new Uri(new Uri(baseUrl), pageUrl); Driver.Navigate().GoToUrl(fullUrl); if (LoginPage.AmOnPage(Driver)) { new LoginPage(Driver).Login(username, "Password"); Driver.Navigate().GoToUrl(fullUrl); } else if (!Is404() && !IsErrorPage() && Driver.FindElement(By.Id("user_name")).Text != username) { LoginPage.Load(Driver, baseUrl).Login(username, "Password"); Driver.Navigate().GoToUrl(fullUrl); } }