To deal with alert first we need to understand whats is an alert?Alerts are messages or popups that requires confirmation from users as shown below

alert in browser
1.Alert in Browser

Code for Alert in selenium:


from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC alert=wait.until(EC.alert_is_present()) alert.text alert.accept()

Above code will accept the popup or alert.

By SC

Leave a Reply

Your email address will not be published. Required fields are marked *