Friday, December 30, 2011

Check element existance in Geb

In Geb, if you need to check if some element does exists on page or not the best looking way to do it is method isPresent(), so it can be called like:


Of course if you plan to check non-existing elements like this they need to be defined as not required and with wait - false. For example:

notNeededLink(to: SomePage, required:false, wait: false) {$('a', text:'Some')}


  1. could it be applicable to a div.? I have a problem, I don't know how to check the div if present or not.

  2. I'm using angularjs ng-show="variable that hold boolean from the Controller" to show div if the variable returns true...

  3. thanks Dmitrijs Artjomenko... its working...