python selenium处理iframe和弹框(一)

处理iframe和弹框 

复制代码
# encoding:utf-8
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get("http://www.runoob.com/try/try.php?filename=tryjs_alert")

driver.switch_to_frame("iframeResult")
time.sleep(1)
driver.find_element_by_xpath("html/body/input").click()
time.sleep(1)
al=driver.switch_to_alert()
al.accept()
复制代码

 

posted @   yye_2010  阅读(295)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示