The waitFor expects a closure returning a boolean value. Once the value returned is true, the waiting ends.
As Groovy interprets basically any object as an boolean (see http://groovy-lang.org/semantics.html#Groovy-Truth), this works great with Geb's NonEmptyNavigator (true) and EmptyNavigator (false). In your case, you call click. As click returns null, the result will never be true. waitFor(60) { ObjName }.click() Might work, but you should put the object retrieving inside the closure. waitFor(60) { ObjName.click() true } Might also work if the first line on the closure will throw an exception, which would be catched by Wait. If no exception is thrown, the true will be returned and the waiting will end. Kind regards, Micha Avinash Kumar <[email protected]> schrieb am Do., 11. Juni 2020, 16:50: > Hi, > > I am trying to use waitFor method in different class other than page class. > > For example: > > class test extends page { > > > def clickAnElement(ObjName) > { > > waitFor(60) > { > ObjName.click() > } > } > } > > > and clickAnElement, i am calling from one page class . > but code fails at WaitFor() as WaitFor is not working for me in class > other than page class. > > > Can any help me out in this case. Please > > Thanks > Regards, > Avinash Kumar > > -- > You received this message because you are subscribed to the Google Groups > "Geb User Mailing List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/geb-user/CAMMvVTQGSi1pUnfqADqRGAmTWZjKNZZV11oEY7zOdS1dcFsmMA%40mail.gmail.com > <https://groups.google.com/d/msgid/geb-user/CAMMvVTQGSi1pUnfqADqRGAmTWZjKNZZV11oEY7zOdS1dcFsmMA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/CALYktxNGr4FTR_9TfukTRcRmYa%2BpDJX8B0sruFC-KfGZCA0OKA%40mail.gmail.com.
