/// <summary> /// This method table below parameters and perform operation required to login into website /// </summary> /// <param name="Username"></param> /// <param name="Password"></param> /// <param name="driver"></param> public void login(String Username, String Password, IWebDriver driver) { LoginUI Ui = new LoginUI(); IWebElement GetusernameField = Ui.Username(driver); IWebElement GetSubmitButton = Ui.Submit(driver); KeyboardActions.SendKeys(GetusernameField, Username, driver); MouseActions.Click(GetSubmitButton, driver); IWebElement GetPasswordField = Ui.Password(driver); KeyboardActions.SendKeys(GetPasswordField, Password, driver); IWebElement GetLoginButton = Ui.Submit(driver); MouseActions.Click(GetLoginButton, driver); }
public String PerformLogin(String UsernameValue, String PasssworValue, String ExpectedResult) { try { GenericControl obj = new GenericControl(browser); UITestControl Username = obj.FindControl <HtmlEdit>(UsernNameLocatorType, UsernNameLocatorValue); KeyboardActions.SendKeys(Username, UsernameValue, browser); UITestControl Submit = obj.FindControl <HtmlInputButton>(SubmitLocatordType, SubmitLocatorValue); MouseActions.MouseClick(Submit, browser); UITestControl Password = obj.FindControl <HtmlEdit>(PassworLocatordType, PassworLocatordValue); KeyboardActions.SendKeys(Password, PasssworValue, browser); UITestControl Login = obj.FindControl <HtmlInputButton>(SubmitLocatordType, SubmitLocatorValue); MouseActions.MouseClick(Login, browser); return(ActualResult = ExpectedResult); } catch (Exception e) { return(ActualResult = e.Message); } }