How do I handle an optional modal message that pops up on the screen while using Selenium Robot Framework. For example Insufficient balance alert. I cannot see the current balance on the account, that is retrieved from back end. Depending on the balance the pop up may or maynot show up..
CodePudding user response:
Below code may solve your problem:
try:
modal = browser.switch_to.alert
modal.accept()
except:
# YOUR NORMAL CODE IF MODAL IS NOT GENERATED