Appium 实战练习一

 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()

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

转载于:https://www.cnblogs.com/aziji/p/9732805.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值