How to detect a popup alert which appear during click action

Hello,

Problem:
I’m trying to use getText() when the user click on save button. However, the code below doesn’t work because the popup appear when click action isn’t finish. So I can’t execute the following code.

**Code :
**

WebUI.click(findTestObject(SaveButtonObject))
if(WebUI.getText(findTestObject(inputObject)).length() > 10) {     WebUI.verifyAlertPresent(5)}

There is a solution to do that ?

Thank’s,
Regards

Depends on how it pops up. Is it an alert or a window you have to click? You could try switchwindowindex

Is it an alert that could be detected and dismissed with the Alert commands? You can Wait, Accept, Dismiss, etc.

[WebUI.Alert](https://docs.katalon.com/display/KD/%5BWebUI%5D+Alert "Link: https://docs.katalon.com/display/KD/%5BWebUI%5D+Alert")

Please check below tutorial