alert的使用 from selenium.webdriver.common.alert import Alert #Alert警告框 driver.switch.alert().text #获取警告框文本 driver.switch.alert().accept() #确认 #Confirm确认框 driver.switch.alert().accept() #确认 driver.switch.alert().dismiss() #取消 #Prompt消息对话框 driver.switch.alert().send_keys('值')