I want to make sure that an element is present before the webdriver starts doing stuff.
I\'m trying to get something like this to work:
WebDriverWait w
WebDriverWait won't take effect.
var driver = new FirefoxDriver(
new FirefoxOptions().PageLoadStrategy = PageLoadStrategy.Eager
);
driver.Navigate().GoToUrl("xxx");
new WebDriverWait(driver, TimeSpan.FromSeconds(60))
.Until(d => d.FindElement(By.Id("xxx"))); // a tag that close to the end
This would immediately throw an exception once the page is "interactive". I don't know why but the timeout acts as if not exist.
Perhaps SeleniumExtras.WaitHelpers works but I didn't try. It's official but was split out into another nuget package. You can refer to C# Selenium 'ExpectedConditions is obsolete'.
Myself is using FindElements and check whether Count == 0, if true, use await Task.Delay. It's really not quite efficient.