appium python andiroid自动化文档整理笔记。
2023-09-27 14:27:40 时间
利用一天时间去整理appium for android文档。传送门
利用业余时间自己翻阅资料,google。百度等去查找,费劲一番功夫,最后终于成行了这篇文档。
也是作者对最近自己的学习的一个总结吧,其实平时自己学习感觉是很简单的,可是突然让自己去整理
感觉还是很难的, 感谢自己的努力吧,感谢官网,感谢工具,感谢曾经大家的分享吧,
学习过程中,总是痛苦的,感谢那些优秀的论坛,感谢前辈们的指引,希望大家能够更多的指正。感谢。
文中代码如下展示。
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)
相关文章
- How to run python interactive in current file's directory in Visual Studio Code? Python路径问题
- opencv官方文档:Python通过url获取图片的几种方法以及图像格式之间的转换,imencode()+imdecode()使用
- Python之创建xml文档
- Word处理控件Aspose.Words功能演示:使用 Python 查找和替换 Word 文档中的文本
- Word处理控件Aspose.Words功能演示:在 Python 中从 Word 文档中提取图像
- Word处理控件Aspose.Words功能演示:使用 Python 在 Word 文档中处理 VBA 宏
- [Python] 练习代码
- Google Earth Engine(GEE)——Qgis-earthengine使用 Python API 集成 Google Earth Engine 和 QGIS
- 详解Python列表(list)的方法sort()的第一个参数key【简单清晰明了的讲解】
- 141 python网络编程 - UDP介绍
- 精通Python网络爬虫:核心技术、框架与项目实战.3.3 网页更新策略
- 《Flink官方文档》Python 编程指南测试版(一)
- 《python 与数据挖掘 》一1.3 Python开发环境的搭建
- Python删除txt文档中含有特定词语的行
- gyp ERR! stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- 【python】【pycharm】+封装&导入
- python glob的安装和使用
- 《Python参考手册(第4版•修订版)》——2.7 文档字符串
- 《树莓派Python编程入门与实战(第2版)》——3.5 关于Python交互式shell
- 《Python入门经典》—— 1.5 Q&A
- 《“笨办法”学Python(第3版)》——习题5 更多的变量和打印
- Python视频剪辑AutoCut在文档中合成制作口播视频
- Python教程之基于端到端机器学习的推荐项目,一个基于协同过滤和基于流行度过滤的机器学习推荐项目(项目含源码)
- 基于 Python 官方 GitHub 构建 Python 文档
- 《树莓派Python编程指南》——3.9 习题答案
- 学习python第三天之多行函数