这个是python+selenium之弹窗处理
#coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
driver = webdriver.Firefox()
driver.get('http://www.baidu.com')
ele = driver.find_element_by_link_text(u"设置")
ActionChains(driver).move_to_element(ele).perform()
time.sleep(2)
ele1 = driver.find_element_by_link_text(u"搜索设置")
ele1.click()
ele2 = driver.find_element_by_class_name('prefpanelgo')
time.sleep(2)
ele2.click()
time.sleep(2)
#接受告警框
driver.switch_to_alert().accept()
time.sleep(4)
#等等4秒
driver.quit()
#关闭浏览器
'''
driver.switch_to_alert().text() 返回告警框的文字
driver.switch_to_alert().accept()接受告警框
driver.switch_to_alert().dismiss()解散现在告警框
driver.switch_to_alert().send_keys(keysToSend) 发送文本至告警框
'''