appium(二)简单的demo
来源:互联网 发布:windjview mac 编辑:程序博客网 时间:2024/05/18 00:17
启动appium服务,连接手机,将测试用例demo存放到.py文件中
#-*- coding:utf-8 -*-# 引入类库import time# appiumAPI库from appium import webdriver# from selenium import webdriver# from lib2to3.pgen2.driver import driver# 定义启动设备需要的参数desired_caps = {}# 设备系统desired_caps['platformName'] = 'Android'# 设备系统版本号desired_caps['platformVersion'] = '5.1.2'# 设备名称desired_caps['deviceName'] = 'MI 3'# 要测试的应用的地址# desired_caps['app'] = 'C:\\Users\\Administrator\\Desktop\\123456\\moer_finance-release.apk'# 应用的包名desired_caps['appPackage'] = 'com.moer.moerfinance'desired_caps['appActivity'] = '启动的app的activity'# 启动appdriver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)# 重置应用为初始状态driver.reset()# 设置时间等待,应用在开启的时候需要一定的时间加载页面,如果命令之后没有时间间隔是会导致元素找不到执行错误的time.sleep(5)# 滑动页面,从x1,y1滑动到x2,y2,滑动的时间为500毫秒driver.swipe(800,800,200,800,500)driver.quit()
在cmd中执行给文件,就可以看到手机的执行效果。
from appium import webdriver 引入webdriver类
import time
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '5.1.2'
desired_caps['deviceName'] = 'MI 3'
desired_caps['appPackage'] = 'com.moer.moerfinance'
desired_caps['appActivity'] = 'com.moer.moerfinance.advertisement.AdvertisementActivity'
driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
time.sleep(10)
driver.find_element_by_id("com.moer.moerfinance:id/user_center").click()
time.sleep(5)
driver.find_element_by_id("com.moer.moerfinance:id/main_page_left_portrait_menu").click()
time.sleep(3)
driver.find_element_by_id("com.moer.moerfinance:id/top_bar_login_area").click()
time.sleep(3)
driver.deactivate_ime_engine()
driver.find_element_by_id("com.moer.moerfinance:id/account").send_keys("13269902200")
time.sleep(2)
driver.find_element_by_id("com.moer.moerfinance:id/password").send_keys("654321")
time.sleep(2)
driver.find_element_by_id("com.moer.moerfinance:id/login").click()
driver.quit()
- appium(二)简单的demo
- appium与自动化测试(二) -appium的安装
- Appium的简单实用
- Replugin Demo的简单使用与分析(二)
- Sprinmvc 简单测试Demo(二)
- appium环境配置(二)
- 搭建appium环境(二)
- silverlight超小游戏开发包SmallGameLib(二)—— 一个最简单的DEMO
- Struts2学习笔记(二)使用jQuery—Ajax技术的简单Demo
- java爬虫之基于httpclient的简单Demo(二)
- appium Demo Java篇
- appium Demo python篇
- appium Androiddriver小demo
- Appium+Python+Genymotion,菜鸟demo时遇到的坑
- appium+Python真机运行测试demo的方法
- STL学习(二)set、map、list、deque简单Demo
- gradle学习笔记(二)第一个简单demo
- Quartz学习——Quartz简单入门Demo(二)
- Ehcache工具类 EhcacheUtil
- HTML之认识标签(一)
- Codeforces Round #161 (Div. 2)-D. Cycle in Graph
- HDU 1254 推箱子(BFS + DFS)
- 【SpringBoot】SpringBoot核心-基本配置
- appium(二)简单的demo
- ArcGIS空间分析要点学习
- Fragment Transactions & Activity State Loss
- 5分钟学会两种侧滑菜单栏
- Hadoop、Spark等5种大数据框架对比,你的项目该用哪种?
- linux下生成动态库和静态库的方法
- mongodb配置服务启动
- Pairs Forming LCM [数学][最小公倍数为n的数对]
- MYSQL性能优化的最佳20+条经验