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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -