#!/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的更多相关文章

  1. 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 ...

  2. selenium+python笔记10

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ 我们多添加一些测试场景,比如:删除邮件,查找邮件,发送邮件等等 &qu ...

  3. selenium+python笔记9

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: delete mail 我们多添加一些测试场景,比如:删 ...

  4. selenium+python笔记8

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 定制浏览器 """ imp ...

  5. selenium+python笔记7

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 测试126邮箱的登陆功能 1.使用公共方法public. ...

  6. selenium+python笔记6

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 将登陆动作封装成function "" ...

  7. selenium+python笔记5

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 登陆126邮箱 """ f ...

  8. selenium+python笔记4

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 使用unittest组织用例 ""& ...

  9. selenium+python笔记3

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc:学习unittest的用法 注意setUp/setUpCl ...

随机推荐

  1. 使用jquery构建Metro style 返回顶部

    个人一直对metro风格的东西情有独钟,偶然间在腾讯网看到一款小插件,蓝色Metro风格的,所以决定把它放到我的博客中,这样做应该不会有版权问题吧orz.. Complete code 后言 我把他原 ...

  2. DEBUG模式开关

    在.NET中,有一个特殊的特性可以用:[Conditional("DEBUG")]MyConstructor(IExtensionManager mgr){...}

  3. 无缝漫游 Seamless Roaming

    点击打开链接 如你在由一个以上AP组成的Wifi 无线网中,拿著一部WindowXP 笔记本电脑,乘著汽车在Wifi网中往来,不断通过无线卡Ping 一个目標,你会发现在无线卡过站时,掉包可以高达半分 ...

  4. MTK+Android编译

    1. 修改recovery代码 比如mediatek\custom\itek82_wet_kk\recovery\inc\cust_keys.h ./mk r k ./mk recoveryimage ...

  5. sql server 向oracle导入表

    选择相应的数据库,右键,任务,选择导出数据 点击下一步 选择Microsoft OLE DB Provider for Sql Server 选择下一步 目标选择.net Framework data ...

  6. N年后给自己一些忠诚的建议

    给自己S年后的一封信: 也许,现在的自己已经经历了种种历练,或成为干将,许是拔杆而起的创业者,再者仍然是一名奋斗中的工薪族.无论现在如何,请记得: M年前,自己坐在小房子里写下的信件. 那时候,自己是 ...

  7. UVA 442 二十 Matrix Chain Multiplication

    Matrix Chain Multiplication Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %l ...

  8. Cheatsheet: 2013 10.09 ~ 10.23

    Other 10 Basic Linux Networking and Monitoring Commands You Should Know A simple, portable yet effic ...

  9. 5.Primitive, Reference, and Value Types

    1.Programming Language Primitive Types primitive types:Any data types the compiler directly supports ...

  10. CSS笔记(二)CSS属性选择器

    对带有指定属性的HTML元素设置样式. 参考: http://www.w3school.com.cn/css/css_syntax_attribute_selector.asp 选择器 描述 [att ...