public void login(IWebDriver driver, string user_name, string password) { var wait_login = new WebDriverWait(driver, TimeSpan.FromSeconds(20)); driver.Navigate().GoToUrl(login_url); IWebElement user = wait_login.Until(username => username.FindElement(By.Id("loginForm:email"))); IWebElement pass = wait_login.Until(Pass => Pass.FindElement(By.Id("loginForm:inputPassword"))); clear_fields(user, pass); user.SendKeys(user_name); pass.SendKeys(password); Thread.Sleep(1500); wait_login.Until(sign_in => sign_in.FindElement(By.Id("loginForm:loginBtn"))).Click(); }