Search code examples
geb

Is possible to reload page if at waitfor is not accepted


Is possible to reload page if at waitfor is not accepted? I want to wait for status shows ok on static page but it require a reload of the page. is possible by Geb

Below pseudo example is to illustrate what I want:

class SomeStatusPage extends Page {
   static at = {
        waitFor {
            satusDiv.displayed
            if(!satusDivOK.displayed) {
                tryReload() //The page is static, so try reload and if status went to ok
            }
        }
   }



   static content = { 
     satusDiv {$("div#status) } 
     satusDivOK {satusDiv.find(text: "status is ok") } 
   }
}

Solution

  • In Geb 2.2 refreshWaitFor() method was added which does exactly what you are asking for.