当前位置:网站首页>Appium automation test foundation uiautomatorviewer positioning tool
Appium automation test foundation uiautomatorviewer positioning tool
2022-07-07 01:33:00 【Test - Eight Precepts】
We were doing web It was said when the page was automated , Element positioning is the first step of page Automation .
Empathy App The first step in automated testing , It is also the positioning of elements .
stay APP If you locate elements in , You need some element positioning tools .
APP There are three kinds of element positioning tools in :
uiautomatorviewer
Appium Inspector
Chrome Inspect
( One )uiautomatorviewer Positioning tools
1、uiautomatorviewer Introduce
Before you start writing test code , It is necessary to obtain the information of the application to be tested UI Elements . Can pass uiautomatorviewer
Tool to get the screenshot of the application interface and analyze .uiautomatorviewer
Tool to get the current UI Snapshot of the interface , Provide a visual interface , Check it out. UI Layout structure , And you can view the relevant properties of each control . Use this information to select a specific UI Components , And create APP Automation in UI Test code .
summary :
uiautomatorviewer
The tool is designed to locate Android System APP Elements in the original page .uiautomatorviewer
yes Android SDK A tool in the library , This tool is in Android SDK In the catalog tools Under the folder .(IOS The system is intools\bin
Subdirectory of )uiautomatorviewer
Easy to use , The speed is also relatively fast .
2、uiautomatorviewer Tool opening mode
openuiautomatorviewer
Tools , Here's the picture :
uiautomatorviewer.bat
It's a windows Executable file under the system , Double click to open it .
Double-click to open uiautomatorviewer.bat
, A black window will appear first , Then there will be a uiautomatorviewer
Tool interface .
3、uiautomatorviewer Layout introduction
The whole interface is divided into four areas :
- Work bar area
There are... In the work column 4 Button , From left to right, respectively :
- Open the saved interface snapshot and layout .
- Capture the screen shot of the current mobile phone (Device Screenshoot uiautomator dump).
- Screenshot of device with compressed hierarchy (Device Screenshoot with Compressed Hierarchy (uiautomator dump –compressed))
The difference between the second button and the third button is :
The second button presents the whole layout , The third button only presents a useful control layout .
For example, there is a Frame, But only decorative functions , So when you click the third button , May not be presented . - Save a snapshot and layout of the current screen interface .
- Screenshot area , Display the layout picture displayed on the current screen .
- Layout area , has XML Tree form , Displays the control layout .
- Control property area , When you click a control , The control property information is displayed .
- uiautomatorviewer Tool use
1)uiautomatorviewer
Tool use premise
- open
uiautomatorviewer
Tools - The tested equipment is in power on state ( Mobile phone or simulator )
- Make sure the computer and device are linked , That is to say
cmd Go to the command line terminal ,
Inputadb connect 127.0.0.1:21503
Link carefree Simulator ,
Inputadb devices
Can get the device name .
If the computer is not linked to the device , Click on uiautomatorviewer
The second button in the toolbar , You can't grab the mobile phone interface .
Here's the picture :
2) Grab the screen interface of the current mobile phone
Just click uiautomatorviewer
Grab the second button in the toolbar :
explain : After clicking , The interface on the device will be synchronized to the left side of the tool , Click the control to be viewed on the left , You can see the corresponding details of the control on the right side of the tool .
Tips :
When uiautomatorviewer
When you can't grab the phone screen , You can shut down and restart first adb service .
- adb kill-server
- adb start-server
3) Locate elements in other pages
If you need to continue locating elements in other pages , First operate to the page where you want to locate the element in the device , Click the Photo button in the upper left corner of the tool again , You can grab the latest page element information .
for example :
After positioning, set app Elements in the interface , I also want to locate the page elements of Taobao's home page .
First, open Taobao on your mobile phone app, Enter Taobao app Home page .
And then click uiautomatorviewer
The second button in the toolbar , To grab the new interface .
4) preservation
Click the save button , Can save captured screen shots and a .uix file (XML Format page layout , It is equivalent to page source code ).
We can see that there will be two files mentioned above in the folder .
We can also rename the saved file , Convenient for our future use and management .
5) Open the saved interface snapshot and layout
Click to open the file , You can save screenshots of previously saved pages and .uix File import in .
Click on OK after , Select to display the previously saved interface information , Here's the picture :
After importing, you can locate elements .
explain :
Let's start with uiautomatorviewer
Tool use , About how to locate elements in a page , Later articles will explain in detail .
a key : Supporting learning materials and video teaching
So here I have carefully prepared the detailed information of the above outline in The link below is as follows
边栏推荐
- C language - array
- POJ 3177 Redundant Paths POJ 3352 Road Construction(双连接)
- 1123. 最深叶节点的最近公共祖先
- Taro 小程序开启wxml代码压缩
- Metauniverse urban legend 02: metaphor of the number one player
- Neon Optimization: an optimization case of log10 function
- 7.6 simulation summary
- Installation of gazebo & connection with ROS
- 454-百度面经1
- Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
猜你喜欢
从底层结构开始学习FPGA----FIFO IP的定制与测试
云呐-工单管理制度及流程,工单管理规范
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
LeetCode:1175. Prime permutation
Transplant DAC chip mcp4725 to nuc980
AcWing 361. 观光奶牛 题解(spfa求正环)
对C语言数组的再认识
C language - array
Dark horse notes - create immutable sets and streams
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
随机推荐
Taro applet enables wxml code compression
Typical problems of subnet division and super network construction
黑马笔记---异常处理
Using the entry level of DVA in taro3.*
前置机是什么意思?主要作用是什么?与堡垒机有什么区别?
分享一个通用的so动态库的编译方法
Add the applet "lazycodeloading": "requiredcomponents" in taro,
How to prevent overfitting in cross validation
Js逆向——捅了【马蜂窝】的ob混淆与加速乐
Supersocket 1.6 creates a simple socket server with message length in the header
table表格设置圆角
golang 基础 —— 数据类型
如何管理分布式团队?
Neon Optimization: performance optimization FAQ QA
LeetCode:1175. Prime permutation
数据手册中的词汇
剑指 Offer II 035. 最小时间差-快速排序加数据转换
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
736. LISP syntax parsing: DFS simulation questions
图片打水印 缩放 和一个输入流的转换