selenium+python笔记11
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@desc: search in mail box
"""
import unittest
import os
import sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys cur_dir = os.getcwd()
sys.path.append(cur_dir.split(r'\test_case')[0]) from public import login class TestSearch(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_search_mail(self):
driver = self.driver
driver.get(self.base_url)
# 调用登录模块
login.login(self, 'xxxx', 'xxxx')
# 搜索邮件
driver.find_element_by_xpath("//input[@class='nui-ipt-input' and @type='text']").send_keys(u'小明')
driver.find_element_by_xpath("//input[@class='nui-ipt-input' and @type='text']").send_keys(Keys.ENTER)
#断言搜索邮件标签页面
text = driver.find_element_by_xpath("//div[@id='dvMultiTab']/ul/li[5]/div[3]").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笔记11的更多相关文章
- Python+Selenium学习笔记11 - python官网的tutorial - 定义函数
1 def f(a, L=[]): 2 L.append(a) 3 return L 4 5 print f(5) 6 print f(2) 输出 1 def f(a, L=None): 2 if L ...
- selenium+python笔记10
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 我们多添加一些测试场景,比如:删除邮件,查找邮件,发送邮件等等 &qu ...
- selenium+python笔记9
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: delete mail 我们多添加一些测试场景,比如:删 ...
- 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 ...
随机推荐
- C# 加载xml文档文件及加载xml字符串
//创建XmlDocument对象 XmlDocument xmlDoc = new XmlDocument(); //载入xml文件名 xmlDoc.Load(filename); //如果是xml ...
- C#之winform基础 button1_Click(object sender, EventArgs e)中sender是啥及其用法
镇场诗: 大梦谁觉,水月中建博客.百千磨难,才知世事无常. 今持佛语,技术无量愿学.愿尽所学,铸一良心博客.---------------------------- ...
- 【转载】创建和使用动态链接库 (C++)
原文:http://blog.csdn.net/handforcpp/article/details/3478254 也可参考MSDN: 演练:创建和使用动态链接库 (C++) 我们将创建的第一种类型 ...
- 各种编码中汉字所占字节数;中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030
vim settings set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936,latin1set termencoding=utf-8se ...
- FRM-10001, FRM-10002, FRM-10003 Oracle Form Builder Error Solution
These errors occurred usually due to forms connection problem or some internal problem, the solution ...
- OB命令大全
CALC : 判断表达式 WATCH : 添加监视表达式 AT : 在指定地址进行反汇编 FOLLOW : 跟随命令 ORIG : ...
- JQuery 选中Radio
<tr> <td> <input type="radio" name="rdb" value="启用" che ...
- STORM_0003_linux_zookeeper_storm_遇到的几个问题
1. 首先是花费时间在windows的eclipse下面安装fatjar因为是新版的缘故,装了很久才装上. 后来发现其实mvn可以打包出没有依赖的jar包 2. 然后是按照在ubuntu环境中的mvn ...
- hdu 5154 Harry and Magical Computer 拓扑排序
Harry and Magical Computer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- CSS笔记(十四)CSS3之动画
参考:http://www.w3school.com.cn/css3/css3_animation.asp 通过 CSS3,我们能够创建动画,这可以在许多网页中取代动画图片.Flash 动画以及 Ja ...