java - Selenium element visible listener -
in testing application error , successful messages visible in element has 5-10 second timeout. element shown in event of error , successful messages. not pop-up message. wrote method take screenshot in event of failure. in screenshots error not visible because of it's timeout. appreciate if can give me idea how implement listener catch visibility of error element. can write findelement after every submit command. think it's not practical.
you can use fluentwait -
public boolean fluentwait(webdriver driver, final awaitedelement) { wait<webdriver> wait = new fluentwait<webdriver>(driver) .withtimeout(30, timeunit.seconds) .pollingevery(1, timeunit.seconds) .ignoring(nosuchelementexception.class); boolean flag = wait.until(new function<webdriver, boolean>() { public boolean apply(webdriver driver) { return driver.findelement(locator).isdisplayed(); } }); return flag; };
Comments
Post a Comment