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

  1. selenium+python笔记11

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: search in mail box "&qu ...

  2. selenium+python笔记10

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

  3. selenium+python笔记8

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

  4. selenium+python笔记7

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

  5. selenium+python笔记6

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

  6. selenium+python笔记5

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

  7. selenium+python笔记4

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

  8. selenium+python笔记3

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

  9. selenium+python笔记2

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 操作浏览器 """ fro ...

随机推荐

  1. 一个数如果恰好等于它的因子之和,这个数就称为 "完数 "。例如6=1+2+3.编程     找出1000以内的所有完数。

    package a; public class Wanshu { public static void main(String[] args) { for (int i = 1; i <= 10 ...

  2. CodeForces 478C Table Decorations

    Table Decorations Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u ...

  3. Win 64 register usage

    http://www.mouseos.com/win64/registers.html Seems UEFI using rcx, rdx, r8, r9, r10, r11, r12 to stor ...

  4. MySQL(五) —— 子查询

    子查询(SubQuery)是指出现在其他SQL语句内的SELECT语句. 如: SELECT * FROM t1 WHERE col1 = (SELECT col2 FROM t2); 其中 SELE ...

  5. 安装 SQLManagementStudio_x86_CHS(SQL Server Management Studio) 老提示重启的解决办法

    安装 SQL Server Management Studio(SQLManagementStudio_x86_CHS)时,检测时不通过,提示重启电脑,我以为她安装了什么心软件没有重启:所以重启了电脑 ...

  6. 使用Spring容器

    Spring的两个核心接口:BeanFactory和ApplicationContext,其中ApplicationContext是BeanFactory的子接口. Spring容器就是一个大的Bea ...

  7. mysql启动关闭

    RedHat Linux (Fedora Core/Cent OS) 1.启动:/etc/init.d/mysqld start2.停止:/etc/init.d/mysqld stop3.重启:/et ...

  8. installing a 3D printer

    托公司的福,今天可以自己组装一台3D打印机.心里颇有一种开箱有益的兴奋. 落入手中的是一台Panowin F1,价格不贵,却同时拥有了3D打印功能和激光打印功能.颇有一种小型创客作坊的雏形. 硬件搭建 ...

  9. Codeforces Round #272 (Div. 2) C. Dreamoon and Sums 数学

    C. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input stand ...

  10. [转载] 一共81个,开源大数据处理工具汇总(下),包括日志收集系统/集群管理/RPC等

    原文: http://www.36dsj.com/archives/25042 接上一部分:一共81个,开源大数据处理工具汇总(上),第二部分主要收集整理的内容主要有日志收集系统.消息系统.分布式服务 ...