版权声明:如需转载本文章,请保留出处! https://blog.csdn.net/xc_zhou/article/details/89609177
- Python sample(Python示例)下载
https://github.com/appium/sample-code/tree/master/sample-code/examples/python
其中要求安装:
pip install Appium-Python-Client
pip install pytest
- 启动Appium,并确保已经连接模拟器
启动验证:
启动之后,在浏览器中输入http://localhost:4723/wd/hub/status出现下面代码说明成功
{“status”:0,“value”:{“build”:{“version”:“1.12.1”}},“sessionId”:null}
- 执行官方示例代码
下载地址:https://github.com/appium/sample-code/tree/master/sample-code
添加联系人的示例代码
-
下载对应APK
-
下载Python执行文件
-
修改android_contacts.py文件
下载后的原始文档如下:
修改后,如下
注意:
我遇到的问题:在终端运行时提示:在文件夹中找不到对应的apk文件
直接运行E:\appium1\PythonSamples>android_contacts.py
扫描二维码关注公众号,回复:
6197410 查看本文章
原因:下面代码绝对路径错误
desired_caps['app'] = PATH(
'../../../sample-code/apps/ContactManager/ContactManager.apk'
)
这段代码的地址错误。根据提示将对应的apk文件放到对应的路径就可以了
例如:
desired_caps['app'] = PATH(
'E:/appium1/apps/ContactManager/ContactManager.apk'
)
运行android_contacts.py文件,成功运行
模拟器端的运行情况
Appium Desktop 的简单应用
由于Appium Desktop出来了,所以使用appium要比以前简单许多
1、启动Appium Desktop
2、启动成功后如图,点击inspector
3、查看设备是否链接成功
4、在inspector中添加参数,点击【start Session】
参考:https://testerhome.com/topics/8038
https://testerhome.com/topics/11534