selenium - WebDriverWait timer resets between tests? -
i have following code:
// setting timeout full minute webdriverwait wait = new webdriverwait(driver, 60); actions action = new actions(driver); // first, click usermenu webelement usermenu = wait.until(expectedconditions.elementtobeclickable(by.id("usermenu"))); usermenu.click(); webelement adminportal = driver.findelement(by.id("adminportals")); action.movetoelement(adminportal); action.perform(); // wait secondary menu become available webelement portal = wait.until(expectedconditions.elementtobeclickable(by.id(portalid))); portal.click();
basically, "usermenu" drop-down, , there's hover-over expansion menu "adminportals". above code simulates (in selenium, action of clicking on item in expanded menu.
the question have in relation timeout period. when start counting down? assume when use wait.until(). , assume stops counting once true returned expectedconditions? and, real question is: if use same "wait" twice, have here, 60 seconds reset limit between each use, or restart counting stopped before?
so, if first wait took 2 seconds, , second wait took 3 seconds, timeout third call wait.until() 55 seconds, or reset 60?
yes, starts counting down when call until
method. when instantiate new webdriverwait
object , specify timeout sets clock, each time call util
method on object continue count down same timer. doesn't reset timer each time returns. if want timer reset need create new webdriverwait objects.
this unclear in documentation. had @ code figure out going on. logic inherited fluentwait class. here's source code link looked at:
so, if first wait took 2 seconds, , second wait took 3 seconds, timeout third call wait.until()
55 seconds.
Comments
Post a Comment