Appium元素定位方式之android_uiautomator定位
1. android_uiautomator定位 相当于使用 UiAutomator Api 去递归地搜索元素(Android 专属),可以说android uiautomator是终极定位方式,有的时候一些元素不能够很好的定位时,那么就需要采用android uiautomator去定位,他是一种非常...阅读全文
使用uiautomatorviewer连接模拟器页面报错:Error while obtaining UI hierarchy XML file
使用uiautomatorviewer连接模拟器页面报错:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist! 解决方法1: 杀死adb服务器并重新启...阅读全文
使用uiautomatorviewer连接模拟器页面报错No Android devices were detected by adb.
原因:adb 没有连接上手机模拟器 连接夜神模拟器:解决:cmd——adb connect 127.0.0.1:62001 连接mumu模拟器:解决:cmd——adb connect 127.0.0.1:7555 打开cmd控制台,输入命令adb connect 127.0.0.1...阅读全文
python+appium自动化测试-滑动
一、scroll()方法 Appium 中webdriver提供scroll()方法来滚动页面,该方法只适用于屏幕上已经显示的两个元素,从一个元素滚动到另一个元素。若元素不存在当前屏幕或被遮挡,则无法使用该方法。 方法介绍: scroll(self, start_el, stop_el, duration=N...阅读全文
Appium获取手机分辨率 & 自适应设备下滑刷新
需求背景:appium做手机自动化的时候,有个很固定的需求就是竖直滑动刷新页面信息(比如:微信朋友圈、微博等),开始的时候我是固定写死的,如driver.swipe(300, 1000, 300, 300),但是这样写的弊端也很明显,代码不够健壮,如果遇到小屏设备或者大屏设备,滑动的幅度看起来就可能过大或过小。所以我们...阅读全文
python加Appium判断滑动是否到达屏幕底部
需求:在做appium自动化的过程中遇到一个问题,每次下滑都会刷新页面(比如微信朋友圈),要通过滑动获取所有页面信息,直到滑动到页面底部,但是不知道怎么判断滑动到底部从而终止滑动的循环(appium无法得知滑动成功还是失败) appium本身没有直接判断是否滑动到页面底部的函数,但是我们可以通过一个比较笨的方法来...阅读全文
python退出while循环break、return、continue
while True: break 1、while用于构建循环,while True是无限循环; 2、break用于退出for循环和while循环,当有多层循环时,退出break所在的循环体 3、return是用来结束函数返回数据用的,适用对象不对,所以有报错 4、continu...阅读全文
Python PyInstaller安装和使用教程(详解版)
安装 PyInstaller 模块 pip install pyinstaller 强烈建议使用 pip 在线安装的方式来安装 PyInstaller 模块,不要使用离线包的方式来安装,因为 PyInstaller 模块还依赖其他模块,pip 在安装 PyInstaller 模块时会先安装它的依赖模块。 官网...阅读全文
python自动控制鼠标操作pymouse
安装PyMouse库 1.使用pip可以直接下载pymouse pip install pymouse 或者 pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pymouse 2.第二步:需...阅读全文
NameError: name ‘xxx‘ is not defined问题总结
最近在使用python写实验遇到这个问题: NameError: name ‘xxx’ is not defined 在学习python或者在使用python的过程中这个问题大家肯定都遇到过,在这里我就这个问题总结以下几种情况: 错误NameError: name ‘xxx’ is not def...阅读全文