当前位置:网站首页>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
边栏推荐
- go-zero微服务实战系列(九、极致优化秒杀性能)
- Set up [redis in centos7.x]
- Typical problems of subnet division and super network construction
- 负载均衡性能参数如何测评?
- AcWing 1140. 最短网络 (最小生成树)
- How to evaluate load balancing performance parameters?
- 1123. The nearest common ancestor of the deepest leaf node
- Failed to successfully launch or connect to a child MSBuild. exe process. Verify that the MSBuild. exe
- Supersocket 1.6 creates a simple socket server with message length in the header
- Share a general compilation method of so dynamic library
猜你喜欢
2022 Google CTF SEGFAULT LABYRINTH wp
黑马笔记---创建不可变集合与Stream流
字节P7专业级讲解:接口测试常用工具及测试方法,福利文
Comparison of picture beds of free white whoring
Transplant DAC chip mcp4725 to nuc980
Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
如何管理分布式团队?
AcWing 361. 观光奶牛 题解(spfa求正环)
Wood extraction in Halcon
随机推荐
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
table表格设置圆角
移植DAC芯片MCP4725驱动到NUC980
JTAG debugging experience of arm bare board debugging
从底层结构开始学习FPGA----FIFO IP的定制与测试
AI 从代码中自动生成注释文档
Table table setting fillet
[chip scheme design] pulse oximeter
Meet in the middle
Add the applet "lazycodeloading": "requiredcomponents" in taro,
JS reverse -- ob confusion and accelerated music that poked the [hornet's nest]
云呐|工单管理办法,如何开展工单管理
从零开始匹配vim(0)——vimscript 简介
Yunna | work order management software, work order management software app
What does security capability mean? What are the protection capabilities of different levels of ISO?
Transplant DAC chip mcp4725 to nuc980
hdu 4661 Message Passing(木DP&组合数学)
Taro applet enables wxml code compression
curl 命令
公钥\私人 ssh避password登陆