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()
主要是实现从相机进入预览模式,然后删除一张相片,并检查删除结果
0