Handling Lazy loading with webdriver in C# -


i trying test single page web application webdriver in page object model using c#. website javascript intensive , lazy loading have tried using explicit wait , used following code check if javascript active

return jquery.active == 0 

i have tried using combination of both know if page has loaded

webdriverwait _wait = new webdriverwait(driver, timespan.fromseconds(25));     bool whentoexit = true;             while (whentoexit) // handle timeout somewhere             {                 var ajaxiscomplete = (bool)(browser.driver ijavascriptexecutor).executescript("return jquery.active == 0");                 if (ajaxiscomplete)                 {                       bool isdisplayed = _wait.until(d => d.findelement(by.classname("example"))).displayed;                      if(isdisplayed)                     {                     break;                     }                 }                 thread.sleep(100);                 int timer = 0;                 timer++;                 if (timer == 100)                 {                     whentoexit = false;                 }             } 

.but still webdriver not wait page load , keeps executing steps ,so have been forced use thread.sleep(), dont want use , not practices.
can tell me how around issue,thank u in advance


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -