Checking if element is clickable

438 views
Skip to first unread message

Varun Jain

unread,
Jun 24, 2019, 9:40:30 AM6/24/19
to Geb User Mailing List
Hi,

I am looking for a method to check if the element is clickable. This can be checked in Selenium through the use of ExpectedConditions but I am not able to find a similar thing in Geb. Does anyone have to way to verify that element is clickable

Varun

jc

unread,
Jun 24, 2019, 9:58:20 AM6/24/19
to Geb User Mailing List
As far as I know the ExpectedCondition for waiting for an element to be clickable is waiting for the element to be displayed && enabled.  

I would imagine that just waiting for the navigator should be sufficient which can be done several ways.  You can do this to wait for a navigator:
waitFor{navigator}

Or in your content block for the page you can put a wait on a navigator:
static content= {
   navigator
(wait: true) {...}
}


If you really want to replicate the Selenium wait you could create a method like:
def waitForElementToBeClickable(Navigator nav){
     waitFor
{ nav.displayed && nav.firstElement().enabled }
}

But that really shouldn't be necessary.

Just throwing some ideas out there.

Varun Jain

unread,
Jul 15, 2019, 3:45:37 PM7/15/19
to Geb User Mailing List
Thanks, JC. This is very helpful
Reply all
Reply to author
Forward
0 new messages