Sometime while running automation test cases we faced performance issues with AUT. Page or object fails to load before timeout which leads to false failure. Though page is not getting loaded before timeout period is an issue but we don't want our test cases to fail just because page fails to load.
Following code will wait for page to load indefinitely. Though this may not be a good approach to wait indefinitely for page to load but it helps when we are experiencing serious problem with application performance
{
try
{
Selenium.WaitForPageLoad("5000");
break; //executed if page finished loading
}
catch (Exception)
{
//ignore the timeout exception
}
}