How to detect a popup alert which appear during click action


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 :
if(WebUI.getText(findTestObject(inputObject)).length() > 10) {     WebUI.verifyAlertPresent(5)}

There is a solution to do that ?


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]( "Link:")

Please check below tutorial