java - FluentWait ignore not working as expected -
i have selenium webdriver test failing after dismissing modal window waiting element. specifically, fails looking element in fluentwait call. i've tried various different ways of setting wait, none working. here think should work:
the test code failing:
driver.findelement(by.classname("dismiss")).click(); // dismisses modal window driver.switchto().defaultcontent(); fluentwait<webdriver> fluentwait = new fluentwait<webdriver>(driver) .withtimeout(30, timeunit.seconds) .pollingevery(500, timeunit.milliseconds) .ignoring(nosuchelementexception.class); fluentwait.until(expectedconditions.elementtobeclickable(driver.findelement(by.classname("next")))); driver.findelement(by.classname("next")).click();
here failure happens looking element in wait call:
org.openqa.selenium.nosuchelementexception: unable locate element: {"method":"class name","selector":"next"} command duration or timeout: 1.33 seconds documentation on error, please visit: http://seleniumhq.org/exceptions/no_such_element.html build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32' scheme info: host: '7rzrgv1.bsolver.local', ip: '10.0.3.103', os.name: 'linux', os.arch: 'amd64', os.version: '2.6.32-431.el6.x86_64', java.version: '1.7.0_60' session id: 56c5a752-68fd-4cdb-ae57-2fcefc930f6f driver info: org.openqa.selenium.firefox.firefoxdriver capabilities [{platform=linux, acceptsslcerts=true, javascriptenabled=true, cssselectorsenabled=true, databaseenabled=true, browsername=firefox, handlesalerts=true, browserconnectionenabled=true, webstorageenabled=true, nativeevents=false, rotatable=false, locationcontextenabled=true, applicationcacheenabled=true, takesscreenshot=true, version=24.6.0}]
if replace fluentwait.until phone call thread.sleep(5000), click() works every time.
an interesting note... occurs when running test on headless machine running firefox on top of xvfb. doesn't occur when actual gui present.
so, couple of questions:
why fluentwait not ignoring nosuchelementexception?
does have thoughts on more elegant way deal other implicit wait?
i had same problem. @karna , @axl helped me figure out. using import java.util.nosuchelementexception;
instead of import org.openqa.selenium.nosuchelementexception;
.
java selenium selenium-webdriver
No comments:
Post a Comment