iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Appium 实战练习一
  • 126
分享到

Appium 实战练习一

实战Appium 2023-01-30 22:01:37 126人浏览 安东尼

Python 官方文档:入门教程 => 点击学习

摘要

1 # -*- coding:utf-8 -*- 2 ''' 3 Created on Sep 30, 2018 4 5 @author: SaShuangYiBing 6 7 Comment: 8 ''' 9

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

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

--结束END--

本文标题: Appium 实战练习一

本文链接: https://www.lsjlt.com/news/179818.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作