前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Appium 实战练习一

Appium 实战练习一

作者头像
py3study
发布2020-01-19 15:05:32
3490
发布2020-01-19 15:05:32
举报
文章被收录于专栏:python3
代码语言:javascript
复制
 1 # -*- coding:utf-8 -*-
 2 '''
 3 Created on Sep 30, 2018
 4 
 5 @author: SaShuangYiBing
 6 
 7 Comment: 
 8 '''
 9 import time
10 from appium import webdriver
11 class MyTest(object):
12     def startTest(self):
13         desired_caps = {}        
14         desired_caps['platformName'] ='Android'        
15         desired_caps['platformVersion'] ='9.0'       
16         desired_caps['deviceName'] ='DIYTHYTCCQBIV47D'  
17         # desired_caps['browserName'] = 'Chrome'     
18         desired_caps['appPackage'] ='com.mediatek.hz.camera'        
19         desired_caps['appActivity'] ='com.android.camera.CameraLauncher'     
20         desired_caps["unicodeKeyboard"] ="True"        
21         desired_caps["resetKeyboard"] ="True"        
22         driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
23         
24         driver.launch_app()
25         time.sleep(3)
26         driver.find_element_by_id("com.android.packageinstaller:id/permission_allow_button").click()
27         time.sleep(3)
28         driver.find_element_by_accessibility_id("Most recent photo").click()
29         time.sleep(3)
30         driver.find_element_by_id("com.google.android.apps.photos:id/trash").click()
31         time.sleep(2)
32         driver.find_element_by_id("com.google.android.apps.photos:id/move_to_trash").click()
33         
34         try:
35            driver.find_element_by_id("com.google.android.apps.photos:id/photo_action_bar") 
36            print ("test done")
37         except Exception as e:
38             print (e)
39             print ("test failed")
40 
41 if __name__ == '__main__':
42     test = MyTest()
43     test.startTest()

主要是实现从相机进入预览模式,然后删除一张相片,并检查删除结果

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/03/14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档