In the code below, I attempt to wait until an element is visible:
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
wait.Until(ExpectedCon
public void WaitForElementNotVisible(string id, int seconds)
{
try
{
var wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(seconds));
wait.Until(driver1 => !visibility(id));
Console.WriteLine("Element is not visible..");
}
catch (WebDriverTimeoutException)
{
Assert.Fail("Element is still visible..");
}
}
bool visibility(string id)
{
bool flag;
try
{
flag = driver.FindElement(By.Id(locator)).Displayed;
}
catch (NoSuchElementException)
{
flag = false;
}
return flag;
}