I have some controls in html's section tag and those controls load when ajax
request completed. Now there is a scenario where ajax
is loaded but controls are not appearing on the page and I want to stop code execution till all controls are loaded and visible on the page.
How to identify that all controls are loaded on the page.
I don't want to use the following solutions:
1) Explicit wait in code (because I don't know when controls are loaded).
2) I don't want to use wait.Until(ExpectedConditions.ElementIsVisible(By.Id(id)));
(because if the particular control is not present on the page then it will wait indefinitely)
Any help would be appreciated.
Add the following method to this class
public static void WaitForPageToLoad(this IWebDriver driver) { TimeSpan timeout = new TimeSpan(0, 0, 30); WebDriverWait wait = new WebDriverWait(driver, timeout);
}
This code will wait until all JavaScript is loaded.