当前位置:网站首页>Appium基础 — Appium Inspector定位工具(一)
Appium基础 — Appium Inspector定位工具(一)
2022-07-06 18:03:00 【测试-八戒】
1、Appium Inspector介绍
之前我们说过Appium Server有两种启动方式,
- 一种是
Appium Desktop
有图形界面的启动方式,称之为桌面版; - 另一种版本是通过 npm 安装,使用命令行参数启动的Appium Server。
而Appium Inspector
工具就在Appium Desktop
中,Appium Inspector
是Appium Desktop
附带的一个元素定位检查器,用来调试定位应用程序很方便。Appium Inspector
工具同时支持Android系统和IOS系统中原生界面的元素定位。
2、Appium Inspector打开方式
Appium Desktop
安装完成之后,双击打开。
说明:界面有 3 个 Tab 选项
- Simple:默认配置,监听本机 4723 端口;
- Advanced:高级设置,可以自定义 Appium server 端的配置,配置好后可以保存到Presets;
- Presets:修改Advanced高级设置中的配置项。
一般我们测试直接使用 Simple 即可,点击 Start Server
按钮,启动 Appium server,并开启监听本机 4723 端口。
开启服务后,界面跳转到服务端控制台,如下图:

提示:
控制台显示运行的脚本中的日志信息,右上角有 3 个按钮,分别是:
- 第一个按钮 Start Inspector Session,开启 Appium Inspector 定位工具;
注意:inspector 会新开一个 Session; - 第二个按钮 Get Raws Logs,下载当前控制台中的 log 信息;
- 第三个按钮 Stop Server,关闭当前的 Appium server。
有两种方式可以打开Appium Inspector
工具, - 方式一:点击右上角三个按钮中的第一个(一个放大镜样子的按钮),打开
Appium Inspector
工具。 - 方式二:点击左上角
File
-->New Session Window... Ctrl+N
也可以打开Appium Inspector
工具。
如下图:
Appium Inspector
工具开启后的界面如下图:
3、Appium Inspector布局介绍
说明:
- 布局1是Appium Inspector服务的设置
Automatic Server
:自动服务器Custom Server
:定制服务器Select Cloud Providers
:选择云提供商
我们一般使用Automatic Server
即可:Will use currently-running Appium Desktop server http://localhost:4723
将使用当前运行的Appium桌面服务器http://localhost:4723
。 - 布局2是高级设置
可以设置:Allow Unauthorized Certificates
:允许未经授权的证书Use Proxy
:使用代理服务器
初学一般我们不进行高级设置。 - 布局3是Desired Capabilities参数设置
Desired Capabilities
: 编写Desired Capabilities参数Saved Capability Sets
:已保存的Desired Capabilities,可以进行查看和修改。Attach to Session...
:附加到会话...(用到的时候在说)
4、Appium Inspector工具的配置
1)Appium Inspector
工具使用前提
- 打开
Appium Desktop
,开启Appium Inspector
工具。 - 所测试设备是开机状态(手机或者虚拟机)。
- 确保电脑与设备是链接状态,也就是
cmd进入命令行终端,
输入adb connect 127.0.0.1:21503
链接逍遥模拟器,
输入adb devices
能够获取设备名称。
2)Appium Inspector
的服务器设置和高级设置
- 服务器设置:选择
Automatic Server
(一定要记得点击一下,进行选中) - 高级设置:不进行设置
3)编写Desired Capabilities参数(重点)
可以在左侧一行一行手动添加,如下图:

提示:第二列的格式是针对第三列value而言的。
也可以把Json格式的数据编辑好,直接粘贴在右侧JSON Representation
里。

直接把Json格式的数据直接粘贴过来
点击保存之后,数据会同步到左侧,如下图:
4)保存Desired Capabilities参数
如有需要,在编辑完成Desired Capabilities参数之后,可以对其进行保存,方便以后的管理和使用。


5)查看和修改已存储的Desired Capabilities
点击Saved Capability Sets
标签页,可以查看和修改已存储的Desired Capabilities
。

6)开启Session
,连接手机获取手机界面
点击Start Session
,开启使用Appium Inspector
工具,如下图:
说明
- Appium Inspector需要我们手动创建一个session,其实也就是一个客户端,和Appium server连接,并且需要在Desired Capabilities里面填入一些参数。
- 所需功能是在Desired Capabilities对象中编码的键和值,当请求新的自动化会话时,由Appium客户端发送到Appium server服务器。Desired Capabilities告诉Appium驱动程序有关您希望测试如何工作的各种重要信息。最终Desired Capabilities将作为JSON对象发送到Appium。
- 所需功能的Desired Capabilities对象可以在WebDriver测试中编写脚本,也可以在Appium Server GUI中设置(通过Inspector会话中,就是上边的介绍方式)。
提示:
当Appium Inspector
能够不能抓取手机屏幕时,可以关闭和重启adb服务,或者重启Appium Inspector
服务。 - adb kill-server
- adb start-server
重点:配套学习资料和视频教学
那么在这里我也精心准备了上述大纲的详细资料在下方链接如下

边栏推荐
- WCF基金会
- AI automatically generates annotation documents from code
- C language instance_ three
- C # method of calculating lunar calendar date 2022
- Yunna - work order management system and process, work order management specification
- Machine learning: the difference between random gradient descent (SGD) and gradient descent (GD) and code implementation.
- 云呐|工单管理办法,如何开展工单管理
- 1123. The nearest common ancestor of the deepest leaf node
- 域分析工具BloodHound的使用说明
- c语言—数组
猜你喜欢
How to manage distributed teams?
[advanced C language] 8 written questions of pointer
MySQL script batch queries all tables containing specified field types in the database
系统休眠文件可以删除吗 系统休眠文件怎么删除
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
黑马笔记---创建不可变集合与Stream流
Boot - Prometheus push gateway use
AcWing 361. 观光奶牛 题解(spfa求正环)
Dark horse notes - exception handling
The MySQL database in Alibaba cloud was attacked, and finally the data was found
随机推荐
ZOJ Problem Set – 2563 Long Dominoes 【如压力dp】
C # method of calculating lunar calendar date 2022
[advanced C language] 8 written questions of pointer
【信号与系统】
Let's see through the network i/o model from beginning to end
Transformation transformation operator
Can the system hibernation file be deleted? How to delete the system hibernation file
Supersocket 1.6 creates a simple socket server with message length in the header
WCF基金会
7.6模拟赛总结
Yunna | work order management software, work order management software app
AcWing 344. 观光之旅题解(floyd求无向图的最小环问题)
hdu 4661 Message Passing(木DP&组合数学)
AcWing 904. 虫洞 题解(spfa求负环)
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
从底层结构开始学习FPGA----FIFO IP的定制与测试
Taro 小程序开启wxml代码压缩
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
Make Jar, Not War
Add the applet "lazycodeloading": "requiredcomponents" in taro,