Example #1
0
        public static void LogInAs(string username, string password )
        {
            string currentUser = "";
            try
            {
                currentUser = WebBrowser.CurrentBrowser.Actions.InvokeScript("currentUser");
            }
            catch (ExecuteCommandException)
            { }

            if (!string.Equals(currentUser, username, StringComparison.InvariantCultureIgnoreCase))
            {
                WebBrowser.CleanUp();
                var nav = new Navigation();
                nav.GivenIAmOnSomePage("sign in");
                var input = new UserInput();
                input.GivenIHaveEnteredSomeTestInSomeField(username, "username");
                input.GivenIHaveEnteredSomeTestInSomeField(password, "password");
                input.WhenIPressSomeButton("sign in");
                WebBrowser.CurrentBrowser.WaitForElement(10000, "class=~navbar"); //Give it 5seconds to find header
            }
        }