How to do wait until some text appears in Geb?

28 views
Skip to first unread message

博刘

unread,
Jan 31, 2018, 5:06:18 AM1/31/18
to Geb User Mailing List
Hi there

I'm new to Geb. Currently I have a webpage having a input box and a button. The test scenario will be inputting something, such as "a..d" in the input box and then click the button.

Then the request will be sent and for sometime later, the text in the input box will change to "abcd". Consider the input box is always visible so it seems that waitFor does not work -

waitFor always returns false for "abcd" with waitFor {form.id.getAttribute("value")} == "abcd". I don't want to add sleep(1000) so just want to know if there's anything else good for me use. Thanks!

In capybara I used before, it will automatically wait for the text to be appeared within timeout interval.


Roman Tretyak

unread,
Jan 31, 2018, 6:59:36 AM1/31/18
to Geb User Mailing List
waitFor {form.id.getAttribute("value") == "abcd"}
Note where I close the bracket.

-Roman

среда, 31 января 2018 г., 12:06:18 UTC+2 пользователь 博刘 написал:

博刘

unread,
Jan 31, 2018, 8:27:45 PM1/31/18
to Geb User Mailing List
Thanks Roman. I see why I'm wrong. Now it's working!
Reply all
Reply to author
Forward
0 new messages