#!/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. 一、spring——helloWorld

    1.添加jar包,如下图所示: 2.建立spring项目,如下图所示: 3.验证,如下图所示:

  2. Spring MVC 详解(二)

    前端控制器 在web.xml中配置: 在springmvc.xml中配置springmvc架构三大组件(处理器映射器.适配器.视图解析器) 处理器映射器 在springmvc.xml中配置: Bean ...

  3. CoreData 与 SQLite 比较

    CoreData.framework : iOS中提供了对原始SQLite数据库API访问的封装,通过这个framework来管理数据缓存和持久数据要比使用SQL语句操作SQLite数据库简单和方便许 ...

  4. DirectX 3d 取景变换

    在世界坐标系中,几何体和摄像机都是相对于世界坐标系定义的.但是当摄像机的位置和朝向任意时,投影变换及其它类型的变的就略显困难或效率不高.为了简化运算,我们将摄像机变的至世界坐标系原点,并将其旋转,使摄 ...

  5. node-webkit中使用sqlite3(MAC平台)

    前言 最近使用node-webkit开发一款博客发布软件,来替换难用的Windows Live Writer(主要是对Markdown标签的支持很差劲).为了解决博文信息临时保存的问题,想到了使用sq ...

  6. C# POST与Get数据

    引用DLL 普通Get数据和Post数据 public static string Get(string URL) { String ReCode = string.Empty; try { Http ...

  7. mac 配置jdk maven

    1.从oracle下载jdk 链接:http://www.oracle.com/technetwork/java/javase/downloads/index.html 然后安装jdk 2.下载Mav ...

  8. url 转码 urlencode和 urldecode

    参考网址http://www.t086.com/code/php/function.php-urlencode.php urlencode 将字符串以 URL 编码. 语法: string urlen ...

  9. Scrum Meeting---Ten(2015-11-5)

    今日已完成任务和明日要做的任务 姓名 今日已完成任务 今日时间 明日计划完成任务 估计用时 董元财 分类页设计 4h 商品详单设计 4h 胡亚坤 首页设计 2h 滚动广告栏设计 2h 刘猛 服务器测试 ...

  10. SAP接口编程 之 JCo3.0系列(03) : Table参数

    Table参数作为export parameter BAPI_COMPANYCODE_GETDETAIL是一个适合演示的函数,没有import paramter参数,调用后COMPANYCODE_GE ...