java - Selenium scan page for error elements while waiting -


ok, i'm not sure there ready solution problem is, website trying automated testing on prone "system error"'s. have state machine navigates through various webpages desired result.

the crux of issue selenium doing 120 second timeout while waiting element on page page has on big "system error" instead.

i have framework set can scan page system errors , throw criticalpageexception if finds this. however, want able scan error in webdriverwait.

is there way in java version of selenium, or s.o.l.?

we had similar issue. did created custom waitforwebelement method polls site, similar

public webelement waitforwebelement(final by, final boolean isdisplayed) {     // waiting 30 seconds element present on page, checking     // presence once every 5 seconds.     wait<searchcontext> wait = new fluentwait<searchcontext>(getsearchelement()).withtimeout(timeout, timeunit.seconds).pollingevery(pollseconds, timeunit.seconds).ignoring(nosuchelementexception.class);      webelement webelement = wait.until(new function<searchcontext, webelement>() {         public webelement apply(searchcontext search) {             try{                 webelement element = search.findelement(by);             catch(nosuchelementexception e){                 if(check_your_error_present){                     throw criticalpageexception()                 }else{                     throw e;                 }             }                            return element;         }     });      return webelement; } 

edit : getsearchelement() returns search context


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -