static content = {
        searchVisibleField(required: false) {$("#search-id")}
   }
    def isSearchVisible()
    {
        if (browser.searchVisibleField() == geb.navigator.EmptyNavigator.instance())  {
           false
        }
        else {
           true
        }
    }
    searchVisibleField returns the instance of geb.navigator.EmptyNavigator class so we can use that to check whether an element exists or not in a page. 
Reference from The Book of GEB

 
Thank you. This tip was very useful
ReplyDelete