基于python的selenium实现警告框的处理
来源:互联网 发布:mac的word怎么保存 编辑:程序博客网 时间:2024/05/17 07:22
#coding=UTF-8
'''
Created on 2016-7-8
@author: sun
'''
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
driver=webdriver.Firefox()
driver.implicitly_wait(10)
driver.get("http://www.baidu.com")
#鼠标悬停至设置链接
link=driver.find_element_by_link_text(u"设置")
ActionChains(driver).move_to_element(link).perform()
#打开搜索设置
driver.find_element_by_link_text(u"搜索设置").click()
#保存设置
driver.find_element_by_class_name("prefpanelgo").click()
time.sleep(2)
#接受警告框
driver.switch_to_alert().accept()
driver.quit()
'''
Created on 2016-7-8
@author: sun
'''
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
driver=webdriver.Firefox()
driver.implicitly_wait(10)
driver.get("http://www.baidu.com")
#鼠标悬停至设置链接
link=driver.find_element_by_link_text(u"设置")
ActionChains(driver).move_to_element(link).perform()
#打开搜索设置
driver.find_element_by_link_text(u"搜索设置").click()
#保存设置
driver.find_element_by_class_name("prefpanelgo").click()
time.sleep(2)
#接受警告框
driver.switch_to_alert().accept()
driver.quit()
0 0
- 基于python的selenium实现警告框的处理
- selenium+webdriver+python 中警告框的处理方法
- selenium:3.selenium的多窗口切换与警告框处理
- 基于python的selenium实现多窗口切换
- 基于python 3 的selenium模块实现网页自动登陆
- 基于python的selenium实现多窗口切换
- Selenium基于iframe标志的处理
- selenium基于python的环境配置
- 基于Selenium的web自动化框架(python)
- 基于Python+selenium的自动化测试基础
- 基于selenium的自动化测试框架实现
- 基于Python的Selenium自动化— 实现验证码截取并识别
- python-day0002-搭建基于python的selenium web测试环境
- selenium+Python 实现简单的网页测试
- python+selenium 点击单选框-radio的实现
- Python selenium的js扩展实现
- 基于bootstrap 模态框的警告框
- 基于Python的网页文档处理脚本实现
- 深入解析线程池的使用
- setTimeout延时0毫秒的作用
- 栈溢出攻击
- 大数加法
- ListView的item点击事件及item中子view的点击事件冲突处理方法和思路
- 基于python的selenium实现警告框的处理
- php的四种基本算法
- 07.12C
- /etc/passwd 和 /etc/shadow 文件内容及其解释
- IOS中复制对象的用法及深拷贝和浅拷贝详解
- 2016年工作中遇到的问题41-50:Dubbo注册中心奇葩问题,wifi热点坑了
- 事务的隔离等级 (ANSI标准)
- HDFS理论及基本命令
- java之下载word文档2之遍历模板和文件名中文为空和乱码