Appium+python实现App自动化登录
来源:互联网 发布:数据库系统实现 ppt 编辑:程序博客网 时间:2024/06/07 02:16
Appium+python实现App自动化登录
以下是个人用Appium + python写的第一个App自动化案例,仅做单页面,比较简单,后续将涉及到主功能模块化,需使用到功能时调用即可。
- 获取设备及应用信息
desired_caps = {}desired_caps['platformName'] = 'Android' # 设备系统desired_caps['platformVersion'] = '5.1.1' # 设备系统版本desired_caps['deviceName'] = 'REDmi 3' # 设备名称desired_caps['appPackage'] = 'com.formax.life'desired_caps['appActivity'] = 'formax.life.main.BootProxyActivity'
2.获取Appium client端口值
driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)
3.根据UIautomater定位元素
time.sleep(5)driver.find_element_by_name('我的').click()time.sleep(5)driver.find_element_by_name('登录/注册').click()time.sleep(5)driver.find_element_by_name('手机号').send_keys('13112341237')time.sleep(3)driver.find_element_by_id('pwd_edit').send_keys('ss123456')time.sleep(3)driver.find_element_by_name('登录').click()time.sleep(5)
4.原始代码
# -*- coding:utf-8 -*-import os, time, unittestfrom selenium import webdriverdesired_caps = {}desired_caps['platformName'] = 'Android' # 设备系统desired_caps['platformVersion'] = '5.1.1' # 设备系统版本desired_caps['deviceName'] = 'REDmi 3' # 设备名称desired_caps['appPackage'] = 'com.formax.life'desired_caps['appActivity'] = 'formax.life.main.BootProxyActivity'driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)time.sleep(5)driver.find_element_by_name('我的').click()time.sleep(5)driver.find_element_by_name('登录/注册').click()time.sleep(5)driver.find_element_by_name('手机号').send_keys('13112341237')time.sleep(3)driver.find_element_by_id('pwd_edit').send_keys('ss123456')time.sleep(3)driver.find_element_by_name('登录').click()time.sleep(5)driver.quit()
0 0
- Appium+python实现App自动化登录
- Appium+python自动化-启动app
- 利用Appium实现App自动化测试
- Appium+Python+Django手机app自动化方案实现以及环境搭建
- python-appium自动化测试如何实现滑动
- 2.安卓app自动化测试-初识python调用appium
- APP H5 混合自动化使用说明 [基于 Appium+Python 系列]
- Appium+Python自动化测试(二)--运行App程序示例
- app自动化(1)-基于genymotion和appium,python
- appium 下 python 脚本自动化测试iOS APP 实例
- Appium+python自动化学习(一)——启动APP
- appium+python自动化测试
- Appium python 自动化
- app自动化测试3---appium
- 用python做自动化测试--Andriod App 的自动化-Appium的那些坑
- Python + Appium+ IOS自动化测试
- appium+python自动化测试模板
- Appium+python自动化环境搭建
- Spring示例工程
- zzuli 2131: Can Win(最大流 公平分配)@
- unity wav 格式音频转 写入本地
- StringBuilder、StringBuffer和String三者的联系和区别
- 你真的了解JAVA中的main方法吗?
- Appium+python实现App自动化登录
- uva 325 Identifying Legal Pascal Real Constants
- Python入门之循环分支
- 图像处理、计算机视觉、算法相关资源
- 文件系统使用总结
- C++常见内存错误汇总
- Controlling Object Visibility and Editability in Unity Using HideFlags
- vb.net 教程 3-2 窗体编程之窗体 4
- java-记录一个子串在整串中出现的次数