public bool WaitForBrowserStability(int maxWait)
{
bool retValue = false;
DateTime dtStart = DateTime.Now;
do
{
System.Threading.Thread.Sleep(sleepTime);
if (IsBrowserLoaded())
{
retValue = true;
break;
}
} while (((TimeSpan)DateTime.Now.Subtract(dtStart)).TotalMilliseconds < maxWait);
return retValue;
}
public bool IsBrowserLoaded()
{
try
{
return ("true" == _selObj.GetEval("((\"complete\" == selenium.browserbot.getCurrentWindow().document.readyState) && (null == selenium.browserbot.getCurrentWindow().event))"));
}
catch (SeleniumException selExc)
{
Log.Warn(DateTime.Now.ToString() + " : Selenium error encountered. " + selExc.Message);
_selObj.SelectWindow("");
return false;
}
catch (Exception exc)
{
throw exc;
}
}
Recomended:Open Source Automation framework
Friday, June 26, 2009
Subscribe to:
Post Comments (Atom)
Dude .. nice .. but can u tell me what is the difference between that and WaitForPageLoad ? I do realize WaitForPageLoad is sometimes a bit dodgy, but it still works ... why do you need to avoid it ??
ReplyDeleteThanks ...
Sometimes when page is already loded, or for some javascript exception in AUT the page do not loads even when you perform some operation expecting it to load, in such scenario WaitForPageLoad throws exception after given time.
ReplyDeletehi,
ReplyDeleteAny idea about Webdriver...
Can u give me some intro and guiding to work with webdriver selenium 2.0...
thx
SCSVEL
After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
ReplyDelete360DigiTMG artificial intelligence course in hyderabad
Selenium is an open-source software testing framework for automating web application testing. It validates web applications and checks compatibility issues across different platforms to determine whether they function correctly. Developers and testers use multiple programming languages, including Java, Python, Ruby, etc., to write Selenium test scripts that help them automate interactions
ReplyDeletewith a web browser.