public void ClickWhenVisible(string element, string drivertype = "chrome") { try { new WebDriverWait(_webDriver.WebDriver(drivertype), TimeSpan.FromSeconds(10)).Until( ExpectedConditions.ElementToBeClickable(_webPage.FindElement(By.Id(element)))).Click(); } catch (StaleElementReferenceException) { _webPage.FindElement(By.Id(element)).Click(); } }