jquery - How I can check whether a page is loaded completely or not in web driver? -
i writing java webdriver code automate application. how can correctly check whether page has been loaded or not? application has ajax calls, too.
i have declared implicit wait webdriver.
selenium you. or @ least tries best. falls short, , must little bit. usual solution implicit wait
solves of problems.
if know you're doing, , why you're doing it, could try write generic method check whether page loaded. however, can't done every web , every situation.
related question: selenium webdriver : wait complex page javascript(js) load, see answer there.
shorter version: you'll never sure.
the "normal" load easy - document.readystate
. 1 implemented selenium, of course. problematic thing asynchronous requests, ajax, because can never tell whether it's done or not. of today's webpages have scripts run forever , poll server time.
the various things under link above. or, 95% of other people, use implicit wait
implicity , explicit wait
+ expectedconditions
needed.
e.g. after click, element on page should become visible , need wait it:
webdriverwait wait = new webdriverwait(driver, 10); // can reuse 1 webelement elem = driver.findelement(by.id("myinvisibleelement")); elem.click(); wait.until(expectedconditions.visibilityof(elem));
Comments
Post a Comment