当前位置:
首页 >
Appium+python实现App自动化登录
发布时间:2024/1/8
50
豆豆
生活随笔
收集整理的这篇文章主要介绍了
Appium+python实现App自动化登录
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
Appium+python实现App自动化登录
以下是个人用Appium + python写的第一个App自动化案例,仅做单页面,比较简单,后续将涉及到主功能模块化,需使用到功能时调用即可。
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, unittest from 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()总结
以上是生活随笔为你收集整理的Appium+python实现App自动化登录的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 华为中兴为何对未来信心十足?
- 下一篇: python绘图设置正交坐标等距_pyt