I have a test script and it has an alert handling
I used WebUi.Accept alert () keyword to handle the alert.
PFA,
- alert will display after clicking the step 4.2
- and in step 4.3 i accept the alert
but in step 4.2 I’m getting switching to default content failed due to the alert present
and in step 4.3 I’m getting No alert Found
The following post may help:
1 Like
Got the solution
when I tried to click on the button a second time alert Keywords were able to identify the alert.
so I implemented the following to handle it
by referring Alerts are displayed, but disappear before I can accept it - #29 by Matthew_Loo
WebUI.click(findTestObject('Web/Sales Order Upload/Upload Data button'))
try { WebUI.delay(2)
WebUI.verifyAlertPresent(1)
}
catch(Exception ex) {
WebUI.switchToDefaultContent()
WebUI.click(findTestObject('Web/Sales Order Upload/Upload Data button'))
}