closing a Pop-up opens creates another pop-up

2 views
Skip to first unread message

GebUser

unread,
Dec 10, 2020, 3:12:50 PM12/10/20
to Geb User Mailing List
hi,
How can I handle this situation with Geb WithAlert?
1)click a submit button opens opo-up # 1
2) Verify text in pop-up #1 and click OK button to close it
3) Closing pop-up # 1 opens pop-up #2 
4)Verify text in pop-up # 2 and click OK button to close it

I tried the following command but it is closing both the pop-ups

withConfirm(true) {clickSubmitBtn()} == "Are you sure you want tosubmit?"}

Thanks,
Ramesh

Marcin Erdmann

unread,
Dec 10, 2020, 4:54:39 PM12/10/20
to geb-...@googlegroups.com
I believe you will need to use nested withConfirm() calls in this case:

def firstPopupText
def secondPopupText

secondPopupText = withConfirm(true) {
    firstPopupText = withConfirm(true) { clickSubmitBtn() }
}

I've not tested it but I checked the implementation and there's also a test for nested confirms (geb.AlertAndConfirmHandlingSpec.nested confirms) so I'm fairly sure it will work.

Marcin

--
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 geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/547af3b6-3450-4ab3-b153-66ce598e0117n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages