1.下载解压android-sdk-windows-appium
//配置环境: ANDROID_HOME:D:\android-sdk-windows-appium path:...;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools; //验证: C:\Users\Administrator>adb version Android Debug Bridge version 1.0.40 Version 4986621 Installed as D:\android-sdk-windows-appium\platform-tools\adb.exe
2.安装模拟器(真机测试忽略此步)
>模拟器连接
C:\Users\Administrator\Desktop>adb connect 127.0.0.1:62001 adb server version (36) doesn‘t match this client (40); killing... * daemon started successfully connected to 127.0.0.1:62001 C:\Users\Administrator\Desktop>adb devices List of devices attached 127.0.0.1:62001 device
>真机连接
... 待续...
3.安装appium-desktop-setup-1.8.2.exe默认安装即可;
下载地址:https://github.com/appium/appium-desktop
4.appium工具配置介绍
(1)简单配置介绍
Simple //简单配置 Host 127.0.0.1 //IP配置 Port 4723 //监听端口配置//Start Server v1.9.1
[Appium] Welcome to Appium v1.9.1 [Appium] Non-default server args: [Appium] address: 127.0.0.1 [Appium] Appium REST http interface listener started on 127.0.0.1:4723 //欢迎开启Appium v1.9.1,本地运行IP端口127.0.0.1:4723
(2) Advanced 高级配置
Server Address 本地IP Server Port 端口 Logfile Path 日志输出到文件地址(默认输出appium运行页面) Log Level 日志输出级别,优先级从高到低依次为:FATAL ERROR WARN INFO DEBUG Override Temp Path 覆盖临时目录 Node Config File Path 并发测试设置 Local Timezone 当前的时区 Allow Session Override 允许会话覆盖 Log Timestamps 日志时间戳 Supress Log Color 不显示日志颜色区分
(3) 开启会话
> "deviceName": "127.0.0.1:62001"
C:\Users\Administrator\Desktop>adb devices List of devices attached 127.0.0.1:62001 device
> "platformName": "Android"
>"appPackage": "com.baidu.BaiduMap"//包名
>"appActivity": "com.baidu.baidumaps.WelcomeScreen"//启动程序入口类名
//获取包名和类名 1.进入aapt.exe文件当前目录,打开dos窗口输入 D:\android-sdk-windows-appium\build-tools\28.0.3>aapt dump badging C:\Users\Admi nistrator\Desktop\test\com.baidu.BaiduMap-1.apk //Enter package: name=‘com.baidu.BaiduMap‘ versionCode=‘928‘ versionName=‘10.17.3‘ compi leSdkVersion=‘29‘ compileSdkVersionCodename=‘10‘ install-location:‘auto‘ ... launchable-activity: name=‘com.baidu.baidumaps.WelcomeScreen‘ label=‘鐧惧害鍦板浘‘ icon=‘‘ ... //package: name=‘com.baidu.BaiduMap‘ //launchable-activity: name=‘com.baidu.baidumaps.WelcomeScreen‘
保存配置,方便下次使用
start session 开启会话
(4) 下载保存日志
(5) 暂停appium 运行
5.start session 开启会话后的功能详解
(1)元素选择
(2) 滑动功能,选择第一个点,再选择第二个点后开始执行滑动刷新
(3) 坐标点击-实时点击模拟器也随之响应点击的效果
(4) 录制
(5) 其他按钮
6.如果平时编写脚本的话可以使用uiautomatorviewer.bat元素探测工具如下(打开前提是关闭appium会话,否则会报错)
打开路径:D:\android-sdk-windows-appium\tools\uiautomatorviewer.bat
未完待续...
原文地址:https://www.cnblogs.com/xiaozhaoboke/p/11273657.html
时间: 2024-10-07 13:34:08