# -*- coding:utf-8 -*-
'''
Created on Sep 30, 2018 @author: SaShuangYiBing Comment:
'''
import time
from appium import webdriver
class MyTest(object):
def startTest(self):
desired_caps = {}
desired_caps['platformName'] ='Android'
desired_caps['platformVersion'] ='9.0'
desired_caps['deviceName'] ='DIYTHYTCCQBIV47D'
# desired_caps['browserName'] = 'Chrome'
desired_caps['appPackage'] ='com.mediatek.hz.camera'
desired_caps['appActivity'] ='com.android.camera.CameraLauncher'
desired_caps["unicodeKeyboard"] ="True"
desired_caps["resetKeyboard"] ="True"
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) driver.launch_app()
time.sleep(3)
driver.find_element_by_id("com.android.packageinstaller:id/permission_allow_button").click()
time.sleep(3)
driver.find_element_by_accessibility_id("Most recent photo").click()
time.sleep(3)
driver.find_element_by_id("com.google.android.apps.photos:id/trash").click()
time.sleep(2)
driver.find_element_by_id("com.google.android.apps.photos:id/move_to_trash").click() try:
driver.find_element_by_id("com.google.android.apps.photos:id/photo_action_bar")
print ("test done")
except Exception as e:
print (e)
print ("test failed") if __name__ == '__main__':
test = MyTest()
test.startTest()
主要是实现从相机进入预览模式,然后删除一张相片,并检查删除结果