from appium import webdriver
import time,unittest,HTMLTestRunner
class Testlogin(unittest.TestCase):
    def setUp(self):
        self.desired_caps={}
        self.desired_caps['platformName'] = 'Android'
        self.desired_caps['deviceName']='a6969'
        self.desired_caps['preformVersion']='5.0.2'
        self.desired_caps['appPackage'] = 'com.tencent.mobileqq'
        self.desired_caps['appActivity'] ='.activity.SplashActivity'
        self.driver=webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps)
        time.sleep(2)
    def tearDown(self):
        self.driver.find_element_by_id('com.tencent.mobileqq:id/conversation_head').click()
        self.driver.find_element_by_id('com.tencent.mobileqq:id/settings').click()
        self.driver.find_element_by_id('com.tencent.mobileqq:id/account_switch').click()
        self.driver.find_element_by_id('com.tencent.mobileqq:id/logoutBtn').click()
        self.driver.find_element_by_id('com.tencent.mobileqq:id/dialogRightBtn').click()
        self.driver.quit()
    def testLogin1(self):
        self.driver.find_element_by_id('com.tencent.mobileqq:id/btn_login').click()
        time.sleep(2)
        me=self.driver.find_element_by_android_uiautomator('new UiSelector().text("QQ号/手机号/邮箱")')
        me.clear()
        me.send_keys('319197149')
        password=self.driver.find_element_by_id('com.tencent.mobileqq:id/password')
        password.clear()
        password.send_keys('lileilei.930423')
        self.driver.find_element_by_id('com.tencent.mobileqq:id/login').click()
        m=self.driver.find_element_by_id('com.tencent.mobileqq:id/conversation_head')
        if m is not None:
            print('login is sucess')
        else:
            print('login is Flase')
            print(self.driver.find_element_by_id('com.tencent.mobileqq:id/dialogText').text)
if __name__ == '__main__':
    suiteTest = unittest.TestSuite()
    suiteTest.addTest(Testlogin("testLogin1"))
    now=time.strftime('%Y-%m%d',time.localtime(time.time()))
    report_dir= r'%s.html'%now
    re_open= open(report_dir,'wb')
    runner=HTMLTestRunner.HTMLTestRunner(stream=re_open,title='QQ测试',description='测试结果')
    runner.run(suiteTest)

appium python andiroid自动化文档整理笔记的更多相关文章

  1. appium python andiroid自动化文档整理笔记。

    利用一天时间去整理appium for android文档.传送门 利用业余时间自己翻阅资料,google.百度等去查找,费劲一番功夫,最后终于成行了这篇文档. 也是作者对最近自己的学习的一个总结吧, ...

  2. appium+python+Windows自动化测试文档

    appium+python自动化测试文档 一.认识appium 1.    什么是appium appium是开源的移动端自动化测试框架: appium可以测试原生的.混合的.以及移动端的web项目: ...

  3. golang学习笔记7 使用beego swagger 实现API自动化文档

    golang学习笔记7 使用beego swagger 实现API自动化文档 API 自动化文档 - beego: 简约 & 强大并存的 Go 应用框架https://beego.me/doc ...

  4. python+selenium自动化软件测试(第12章):Python读写XML文档

    XML 即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进 行定义的源语言.xml 有如下特征: 首先,它是有标签对组成:<aa></aa> ...

  5. 【转】 文档与笔记利器 reStructuredText 和 Sphinx

    关于制作文档和笔记这种事,我已经纠结了很久,网上解决方案也一大推,我试过几样,ScrapBook 和 Zotero,编辑不太方便,同步麻烦.Google Note 过于格式简单,现在也不更新了,Goo ...

  6. Ionic2文档整理

    来自:Rainey's Blog 原文地址:http://rainey.space/2016/04/06/Ionic2_Chinese_Document/ Github:https://github. ...

  7. Keras 文档阅读笔记(不定期更新)

    目录 Keras 文档阅读笔记(不定期更新) 模型 Sequential 模型方法 Model 类(函数式 API) 方法 层 关于 Keras 网络层 核心层 卷积层 池化层 循环层 融合层 高级激 ...

  8. 使用Python从Markdown文档中自动生成标题导航

    概述 知识与思路 代码实现 概述 Markdown 很适合于技术写作,因为技术写作并不需要花哨的排版和内容, 只要内容生动而严谨,文笔朴实而优美. 为了编写对读者更友好的文章,有必要生成文章的标题导航 ...

  9. Openstack python api 学习文档 api创建虚拟机

    Openstack python api 学习文档 转载请注明http://www.cnblogs.com/juandx/p/4953191.html 因为需要学习使用api接口调用openstack ...

随机推荐

  1. 转载_2016,Java成神初年

    原文地址:http://blog.csdn.net/chenssy/article/details/54017826 2016,Java成神初年.. -------------- 时间2016.12. ...

  2. Win10快速关机的快捷键

    Win10快速关机的快捷键... ------------------------------- -------------------------------------------- 关机程序的位 ...

  3. JDBC的链接及封装

    导入 mysql 的jar包 jar包:可以直接拿来用,又不想我们看到源代码   sql语句 一定注意:当update,delete时 一定注意where 条件,一定要写!!! public stat ...

  4. Firefox插件推荐

    介绍一下我常用的几个Firefox插件,不一定适合所有人. 图中所示4个插件是我仅有的4个addons,除了stylish,其他几个已经伴随我多年. 1.Adblock Plus(强烈推荐) 广告拦截 ...

  5. Python程序练习1-模拟用户登录验证

    1.功能简介 此程序模拟用户登录验证的过程,实现用户名输入.黑名单检测.用户有效性判别.密码输入及验证等.用户在3次以内输入正确密码登陆成功,连续输错3次密码登陆失败,且该用户名被记录在黑名单,黑名单 ...

  6. hdu4746 Mophues

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4746 题意:给出n, m, p,求有多少对a, b满足gcd(a, b)的素因子个数<=p,(其 ...

  7. vue.js拓展篇(8):测试开发与调试

    内容 第15章:测试开发与调试 任何实际项目的开发,除了功能性代码的完成,规范的开发流程和严谨的测试都是不可或缺的.合理使用工具将事半功倍. 1.ESLint ESLint是Lint语法检查工具,避免 ...

  8. GCC和G++区别

    原文:http://www.cnblogs.com/samewang/p/4774180.html 看的Linux公社的一篇文章,觉得不错,内容复制过来了. 其实在这之前,我一直以为gcc和g++是一 ...

  9. 报表 jasper + ireport5.6

    下载 iReport-5.6.0,jdk7,以及众多lib , 这里我提供下资源(我的百度云) 安装好iReport-5.6.0和jdk7,  在安装目录的\etc\ireport.conf,修改其中 ...

  10. JS基础-----JS中的分支结构及循环结构

    [分支结构] 一.if-else结构 1.结构的写法:if(判断条件){ //条件为true时,执行if的{} }else{ //条件为false时,执行else的{} } 2.注意事项 ①else语 ...