internal void LoginSuccess() { ExcelReader.PopulateInCollection("Login"); string usrname = ExcelReader.ReadData(2, "UserName"); string pwd = ExcelReader.ReadData(2, "Password"); string usrcmd = String.Format("document.getElementById('UserName').value = '{0}'", usrname); string pwdcmd = String.Format("document.getElementById('Password').value = '{0}'", pwd); JSExecutor.JavaScriptExec(driver, usrcmd); JSExecutor.JavaScriptExec(driver, pwdcmd); loginbtn.Click(); }
internal void LoginSuccess() { ExcelLibHelpers.PopulateInCollection(@"C:\Users\Abishake Vipinan\source\repos\ConsoleApp3\ConsoleApp3\TestData\Book1.xlsx", "TMSheet"); // Identfying the username //IWebElement firstName = driver.FindElement(By.Id("UserName")); String username = "******"; JSExecutor.Script(driver, username); //firstName.SendKeys(ExcelLibHelpers.ReadData(2, "Username")); //Identify password //IWebElement password = driver.FindElement(By.Id("Password")); password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); // Identify Login and click //IWebElement loginbtn = driver.FindElement(By.XPath("//*[@id=\"loginForm\"]/form/div[3]/input[1]")); loginbtn.Click(); }
public static void InitializeJScript(Document document) { JSExecutor.SetGlobalValue("document", document); }