当前位置:网站首页>Appium mobile terminal automated testing -- building a simulator and real machine environment
Appium mobile terminal automated testing -- building a simulator and real machine environment
2022-04-22 01:28:00 【Ali program ape Niuniu】
Catalog
Simulator -- install Android Studio And Android SDK
Simulator -- change VDM Default storage path
Real machine (Android) Environment settings
Real machine -- Open developer mode
Real machine -- open USB debugging
Real connection -- File transfer
adopt npm install Appium Server
Appium Server Possible causes of installation difficulties :
Get the notes of automation test course for free + More learning materials + Full video + Interview questions , Click here to get
Simulator -- install Android Studio And Android SDK
Direct installation is recommended Android Studio, And then use Android Studio install SDK. start-up SDK Manager, Install the version you need , Download and install .

Insert picture description here

Insert picture description here
Then set it up ANDROID_HOME environment variable ANDROID_HOME=D:\InstallationDirectory\Android\android-sdk

Insert picture description here
Click after installation Cell phone icon , Create a virtual phone

Insert picture description here
Be careful : Install new Android When selecting the version of virtual machine, try to choose 9.0, At first I chose 10.0, Not very stable when using wait , Haven't taken the time to delve into .

Insert picture description here
The virtual machine has been created successfully , As shown in the figure below :

Insert picture description here
Simulator -- change VDM Default storage path
In New VDM When it comes to virtual machines , Found no new ones C The dish exploded red , It turned out that I forgot to change VDM Storage location , The default is stored in C disc , Eight or nine mobile phones G, No wonder it's not red . The setting method is as follows : ANDROID_SDK_HOME=D:\InstallationDirectory\Android\Android_Virtual And then restart it SDK Manager that will do .

Insert picture description here
Next open cmd Command window , Check whether to connect the mobile phone started by the simulator , Input : adb devices You can view connected devices ; adb devices -l You can view it drivers Details of ;

View connected devices
The above is the simulator environment that needs to be installed when using the simulator .
Here's how to connect the real machine (Android) Operations and settings to be done when
Real machine (Android) Environment settings
Real machine -- Open developer mode
First, you need to have a real Android mobile phone . Connect the real machine , Need to open developer mode . Find it on your phone Set up > System > About mobile phone > Version number , And then click on it 7 Once, you can start the developer mode .

About mobile phone > Version number
After completing the above operations, you will be prompted , You are already in developer mode ; We will be in the setting options , See developer mode , Here's the picture :

Developer options
Real machine -- open USB debugging
stay Developer options or Developer options in , open USB debugging , Here's the picture , stay USB Check... During debugging :

USB debugging
Real connection -- File transfer
When connecting an Android phone to a computer with a data cable , If it happens USB How to connect , There are generally three options : Transmit photos 、 File transfer 、 Charge only , Please select File transfer Then open it on the computer side CMD window , Input :adb devices -l View connected devices .

View device
thus , Both the simulator and the real machine have been set up , Next use cmd Command to start installing downloaded apk Installation package .
install apk file
Here, the installation method is the same for both simulators and real machines . cmd Window input command , install apk Installation package , For example, install the downloaded snowball apk Installation package : adb install D:\InstallationDirectory\apk\xinglicheng.apk Here's the picture , It shows that the installation has been successful , You can go to the simulator or Android Check it on the real machine and it's all installed successfully .

install APK
Here the simulator and real machine environment are ready , The next step is to install Appium Server 了 .
adopt npm install Appium Server
Appium It's using Node.js To develop , So you need to install Node.js 1、 Download and install Node.js ( recommend LTM) and npm https://nodejs.org/zh-cn/download/

Node.JS download
2、 install Appium Method 1 、 Download from the official website Appium Address installation : https://github.com/appium/appium-desktop/releases/tag/v1.15.1
Method 2 、npm install Appium Official installation :npm install -g appium( By the wall ) ( It is recommended to set Taobao first Mirror warehouse Address before installation ) npm install -g cnpm --registry=https://registry.npm.taobao.org npm config set registry https://registry.npm.taobao.org Verify settings Taobao Whether the image is successful : npm config get registry install Appium: cnpm install -g appium
start-up Appium GUI Pattern
Do not change any configuration , choice ” start-up The server “

Appium Interface
The following figure shows that the connection has been successful Click Magnifier Icon , Start the checker session

Appium Server
And set the new pop-up session window , Then start the session
- platformName--- Equipment platform : fill Android or IOS
- deviceName---- Device name : Press top adb Fill in the name of the found equipment ,Android You can fill in any one .
- appPackage---- To start app The package name : Wechat is "com.tencent.mm"
- appActivity---- The interface to launch : The wechat startup interface is ".ui.LauncherUI"
{
"platformName": "android",
"deviceName": "ruancexiaosheng",
"automationName": "uiautomator2",
"appPackage": "com.xueqiu.android",
"appActivity": ".view.WelcomeActivityAlias"
}
Copy
Appium Connect conversation
And then to Appium In the interface , Enter the relevant configuration parameters , choice Customer Server Interface , Then click... In the figure below " Start a session ", You can adjust inspector.

Appium Connect conversation
Then the following figure will appear inspector Connection interface , If the interface is not updated , Click the refresh button in the middle to see the latest interface .

inspector Connection interface
Error: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate. Original error Command 'C:\Program Files\Java\jdk1.8.0_77\bin\bin\java.exe' not found. Is it installed? I don't know why , Feel that the path of the prompt is wrong , Later upgrade to Appium1.15.1 After that, there was no error .
Error: appium Could not connect to server; are you sure it's running? Running Appium when , Choose Customer Server, Just restart it , As shown in the figure below

Custom Server
Appium Server Possible causes of installation difficulties :
- Partly dependent on being inaccessible overseas .
- Node.js Do not use... For installation root Permission installation .
- Node.js The version should not be too low , Not too high , recommend LTS edition , Or from Appium Get the recommended version from the source code .
- need python2 There is .
- node_module Do not have write permission .
- Windows You need to rely on the compiler .
- PATH Variables should be set adb java Equal path , It can be used appium-doctor verification .
- iOS It needs to be solved WebDriverAgent Compilation and dependent download of .
- Okay This is the end of learning If you want to know more about it, please pay attention to me ! The following is a letter that Xiaobian wants to write to readers ! Remember to read carefully !

版权声明
本文为[Ali program ape Niuniu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220111355163.html
边栏推荐
- 【PraNet】主要架构解读-------wmilk
- Kotlin - Introduction to higher order functions
- 05 Lua control structure
- 天边的彩虹很美丽
- The rainbow in the sky is beautiful
- Vnpy chapter of quantitative trading - synchronization module avoids self transaction risk and adds synchronization completion prompt
- PaddlePaddle基本用法详解(四)、PaddlePaddle训练文本分类模型
- [PRANET] thesis and code interpretation (RFB and aggregation) - cavy LAN
- bluemoon靶机渗透测试
- Griddata layout description
猜你喜欢
![[PRANET] interpretation of main architecture ------- wmilk](/img/48/5459fc54809db4c8b71d16f1fae7f9.png)
[PRANET] interpretation of main architecture ------- wmilk
![[PRANET] thesis and code interpretation (RESNET part) -- Jiang Nie](/img/73/35fb594e5b69e33bfc962198f9beb8.png)
[PRANET] thesis and code interpretation (RESNET part) -- Jiang Nie

DVWA系列——File Upload(文件上传)

二维向量的旋转公式

系统工程师面试问题,大专生三面蚂蚁金服

CH4INRULZ靶机渗透测试

【ing】MATLAB工具包-Dynamic Copula Toolbox 3.0详解

(9)JVCL之Edit与打开文件、打开目录、选取时间、按钮、计算器、IP地址的合二为一

腾讯安卓开发面试经验,HR的话扎心了

MSF系列——简介及基本命令使用
随机推荐
Vnpy chapter of quantitative trading - synchronization module avoids self transaction risk and adds synchronization completion prompt
SQL Server 2008 uses over (partition by.. order by..) Syntax error displayed
JS find array subscript
【Pranet】论文及代码解读(Res2Net部分)——peiheng jia
MSF系列——简介及基本命令使用
医学图像分割常见评测指标
二维向量的旋转公式
Fast r-cnn code detailed annotation data shape
2022年年金险有哪些好的产品呢?
C#-- 控制台操作
代码源每日一题 div1 (401-407)
PR如何对裁剪之后的视频进行resize,指定到期望大小?
括号匹配检测 (20 分) C语言
BSides-Vancouver-2018-Workshop靶机渗透测试
Algorithm interview classic 100 questions, sprint for 7 days to win offer
gin的回调函数语法的js实现 & es6的类用法 &js click回调函数打印e怎么实现的
cybox靶机渗透测试
天边的彩虹很美丽
[PRANET] paper code interpretation (loss function) - Blank
Emotional control of investment
