zoukankan      html  css  js  c++  java
  • 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()

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

  • 相关阅读:
    Syn Bot /OSCOVA 基础教程(2)
    Syn Bot /OSCOVA 介绍(1)
    如何访问阿里云内网数据库
    Winform项目中的Settings.settings与App.config
    WinForm项目开发傻瓜教程
    C++读取BMP文件
    boost异步tcp通信技术练习
    lex/flex 学习笔记 一
    流数据解析中高位地址转换的性能分析
    bash随笔
  • 原文地址:https://www.cnblogs.com/aziji/p/9732805.html
Copyright © 2011-2022 走看看