Handling Alerts
On this page you'll learn how to handle alerts with Simple Selenium
Introduction
Simple Selenium Alerts
#Start chrome webdriver with custom options
driver=SimpleSelenium("chrome",save_profile=True,profile_name="myAwesomeProfile",save_logs_in_file=True,maximized=False)
#Visit Alert Test Page
driver.visit("https://testpages.herokuapp.com/styled/alerts/alert-test.html")
#Waits 2 seconds
time.sleep(2)
#Clicks "Show Prompt Box" btn
driver.by_id('promptexample').click()
#Waits 1 second
time.sleep(1)
#You can access the Alerts class with driver.alerts
#Writes text to alert box
driver.alerts.write("Some text to type")
#Accepts alert box
driver.alerts.accept()
List of All Alert Functions
Accept Alert Box
Dismiss Alert Box
Write To Alert Box
Last updated