Skip to main content
1 of 4

a bit of a reimagining but I think will help

selenium actually has a smart wait helper package called DotNetSeleniumExtras.WaitHelpers

you can greatly simplify your code to just

private void WaitFor(IWebDriver driver, By by, TimeSpan wait)
{
    var smartWait = new WebDriverWait(driver, wait);
    smartWait.Until(ExpectedConditions.ElementExists(by));
}

usage

WaitFor(driver, By.XPath(".//*[@id='content']"), TimeSpan.FromSeconds(10));

this way you keep all parameters as open as you need them to be.