in module/geb-core/src/main/groovy/geb/js/DefaultAlertAndConfirmSupport.groovy [166:190]
private captureDialog(Closure installer, String function, Closure actions, Wait wait = null) {
def js = getJavascriptInterface()
installer(js)
def actionsError = null
try {
actions()
} catch (Throwable e) {
actionsError = e
}
def message
try {
message = new PotentiallyWaitingExecutor(wait).execute { popLastDialogMessage(js) }
} finally {
// Need to do this even if actions raised exception
popLastDialogFunctionOnto(js, function)
}
if (actionsError) {
throw actionsError
} else {
message
}
}