Alerts are displayed, but disappear before I can accept it

Sadly the desired Capabilities solution did not work for me.

However, I did notice an interesting quirk, which I managed to take advantage of. In this situation I’m automating the keypress of the delete button on my form. The alert flashed on and then off. If I now manually pressed the delete button the Alert appeared and stayed. So with that in mind, I wrote this, which works. it’s not pretty, please let me know if there’s a nicer way.

So the delete button is effectively pressed twice

WebUI.click(findTestObject(‘the_delete_button’))

try { WebUI.delay(2)
	  WebUI.verifyAlertPresent(1)
	  
	  }
catch(Exception ex) {
	WebUI.switchToDefaultContent()
	WebUI.click(findTestObject('the_delete_button))
}

WebUI.waitForAlert(5)
WebUI.verifyAlertPresent(5)
WebUI.acceptAlert()

3 Likes