selenium+python笔记9
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@desc: delete mail
我们多添加一些测试场景,比如:删除邮件,查找邮件,发送邮件等等
"""
import unittest
import os
import sys
from selenium import webdriver cur_dir = os.getcwd()
sys.path.append(cur_dir.split(r'\test_case')[0]) from public import login # from selenium.webdriver.common.keys import Keys
import time class TestDel(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.base_url = "http://www.126.com/"
self.verificationErrors = []
self.accept_next_alert = True # 搜索邮件
def test_del_mail(self):
driver = self.driver
driver.get(self.base_url)
# 调用登录模块
login.login(self, 'xxxx', 'xxxx')
# 打开收件箱
driver.find_element_by_class_name('nui-tree-item-text').click()
time.sleep(2)
driver.find_elements_by_xpath("//span[@class='nui-chk-symbol']/b").pop(1).click()
try:
spans = driver.find_elements_by_tag_name('span')
for s in spans:
if s.text == u'删 除':
s.click()
except:
pass
# 断言是否已删除
text = driver.find_element_by_css_selector("span.nui-tips-text>a").text
self.assertEqual(text, u'已删除')
# 退出
login.logout(self) def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors) if __name__ == "__main__":
unittest.main()
selenium+python笔记9的更多相关文章
- selenium+python笔记11
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: search in mail box "&qu ...
- selenium+python笔记10
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 我们多添加一些测试场景,比如:删除邮件,查找邮件,发送邮件等等 &qu ...
- selenium+python笔记8
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 定制浏览器 """ imp ...
- selenium+python笔记7
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 测试126邮箱的登陆功能 1.使用公共方法public. ...
- selenium+python笔记6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 将登陆动作封装成function "" ...
- selenium+python笔记5
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 登陆126邮箱 """ f ...
- selenium+python笔记4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 使用unittest组织用例 ""& ...
- selenium+python笔记3
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc:学习unittest的用法 注意setUp/setUpCl ...
- selenium+python笔记2
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 操作浏览器 """ fro ...
随机推荐
- 自动布局(Masonry)设置tabbar
//自定义标签工具栏 - (void) initTabBarView{ // self.bottomView = [[UIView alloc]initWithFrame:CGRectMake(, k ...
- iOS开发,推送消息 steps
概述:推送过程简介 一.App启动过程中,使用UIApplication::registerForRemoteNotificationTypes函数与苹果的APNS服务器通信,发出注册远程推送的申请. ...
- SQL 汉字转换成拼音首字母 首字母查
-- ============================================= -- 功能:汉字转换成拼音首字母 首字母查 -- ========================== ...
- PCL点云库:对点云进行变换(Using a matrix to transform a point cloud)
点云数据可以用ASCII码的形式存储在PCD文件中(关于该格式的描述可以参考链接:The PCD (Point Cloud Data) file format).为了生成三维点云数据,在excel中用 ...
- iOS添加广告的主要方法
//用户取消正在执行的广告时 调用 - (void)cancelBannerViewAction { NSLog(@"Banner was cancelled!"); self.a ...
- Javascript屏蔽回车提交表单
html利用input防止回车提交 默认情况下,单个输入框,无论按钮的type="submit"还是type="button"类型,回车即提交. 1.当type ...
- 表单美化-原生javascript和jQuery下拉列表(兼容IE6)
效果: 思想:用其他标签配合脚本和隐藏的input并通过传值模拟表单元素中的select <!DOCTYPE HTML> <html lang="en-US"&g ...
- 从网页(WEB)登录SAP
以下这篇文章写得很详细,照着做就可以了: http://www.doc88.com/p-293361232332.html 设好后, 默认的端口是80$$, 其中$$是安装SAP时的instanc ...
- tomcat 启用Gzip 压缩进行优化
打开conf/server.xml文件可以看到: <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Con ...
- eclipse查看jdk源码,及反编译查看
jdk中的包: dt.jar是关于运行环境的类库,主要是swing的包 tools.jar是关于一些工具的类库 rt.jar包含了jdk的基础类库,也就是你在java doc里面看到的所有的类的cla ...