当前位置:网站首页>Appium introduction and environment installation
Appium introduction and environment installation
2022-06-24 21:05:00 【gchh_ spring】
appium frame :

appium Ecological tools
adb:Android Of debug Control tools , Used to get android All kinds of data and control
appium desktop: It's embedded qppium server and inspector Integrated tools for
appium server:appium Core tools of 、 Command line tools , by appium client Establish communication mechanism with mobile phones
appium client: Client encapsulation libraries for various languages , Used to connect to appium server, Support python、Java、ruby、robotframework-appium
appcrawler: Automatic traversal tool
appium Environmental installation -windows Environmental Science
Environment installation tools
Java 1.8 edition
android sdk
node js( Recommendation is greater than 10 edition ),npm( Greater than 6 edition , install nodejs I'll bring it later npm The tool ),npm Is a package management tool , Can pass npm To install appium server( My environment is direct installation appium desktop, Contains appium server, All not installed node js and npm)
python3: Use python Language writing , So you need to install python3 Environmental Science
appium desktop: For beginners , You can use this tool to complete script recording
appium python client: Use the client to complete the script writing
The above tools are all around appium From the three parts of , One client , One server End , A mobile terminal
To support the mobile terminal , Need to install jdk、android sdk
The client needs to be installed appium client
server The end needs to be installed node js and appium server Or is it appium desktop
Environmental installation steps -windows Environmental Science
1、 install JDK(1.8 edition )
Download from the domestic image source website jdk 1.8, And install :https://repo.huaweicloud.com/java/jdk/
Configure environment variables :
JAVA_HOME C:\Program Files\Java\jdk1.8.0_171 Pay attention to write yourself here java Installation path for
classpath .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar Notice that you put a dot and a semicolon at the beginning
path %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin path Add these two paths
Check java Is the environment well configured :
Go to the command line , Input java -version perhaps javac -version, The output of version number information is successful
2、 install Android SDK
1、 Download from the download address Android sdk:http://tools.android-studio.org/index.php/sdk
download Windows edition zip Package file sdk package , Download succeeded and unzip , open SDK Readme file , Then execute the command in the extracted path :tools\android.bat update sdk --no-ui, To update this sdk package , When asked whether to install, enter y.
install sdk, Actually sdk It's just a folder , After downloading, you need to update manually , With environment variables, you can use , No manual installation is required
The updated folder is placed in a stable path , And configure the environment variables , Generally not changed
Be careful : Some tools may fail to download when updating the package , It may have something to do with the Internet , You can try to run the above update command multiple times to solve the problem , Or buy an agent directly to solve the problem of network update

2、 Configure after successful installation android sdk environment variable :
ANDROID_HOME D:\android-sdk-windows Configure according to the actual path of your environment
PATH %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
3、 Check if the installation is successful , stay cmd Input adb perhaps adb shell, And then go back
If it shows adb Version information and usage of , The installation and configuration are successful
3、 install appium server perhaps appium desktop, You can choose one of the two to install
appium desktop: The actual is appium server+appium inspector Integration of the two tools , among inspector Is a tool that can be used for script recording and script export , Perfect for beginners , If you install this, you don't need to install appium server
appium server:appium The service side , If you only install this , Recommended npm Installation
Mode one : install appium desktop
Download the installation package of the corresponding operating system :
https://github.com/appium/appium-desktop/releases
What I installed myself was v1.15.1 Version of , Be stable , Download the corresponding installation package according to the operating system , After successful installation , open desktop

Click on Start Server start-up appium server: Start successfully as shown in the figure below

Mode two : Separate installation appium server
It is recommended to install an image provided by Taobao ,node js You need to load it first , Guarantee npm Package tools can use , To download cnpm Tools for , Reuse cnpm install appium
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install -a appium
installed appium after , Type... Directly on the command line appium function , Can display appium The version information and listening port information indicate that the installation is successful
4、appium client install
Depending on the client's choice of encoding language , You need to choose different client, Here is the use of python3 Language , So you need to install python Linguistic client
Use it directly pip Installation :pip install appium-python-client
Or in pycharm Directly install through the interface , After installation, see the figure below :

If import appium No report error , explain appium client Installation successful
5、( Optional ) Use appium-doctor The tool checks whether the environment has been installed
Use cnpm install appium-doctor Command to install doctor Tools , Be careful cnpm It should be installed in advance , See step 3 The instructions in
After the installation is successful, execute directly appium-doctor, I'll check it out appium Installation of associated tools , Some tools must be installed , For example android Automated testing , that ANDROID_HOME,JAVA_HOME,adb Must be installed
Verify that the environment is installed successfully
1、 Start by opening appium desktop perhaps appium server, Don't complain
2、 Prepare one android equipment , Real machine or simulator , Connect to the computer and use adb services See if it's connected , have access to mumu Simulator
adb Connecting device
【win edition 】
adb connect 127.0.0.1:7555
adb shell
【mac edition 】
adb kill-server && adb server && adb shell
3、 Finally, write the test script , Run script
from time import sleep
from appium import webdriver
desire_cap = {"platformName": "android",
"deviceName": "127.0.0.1:7555",
"appPackage": "com.xueqiu.android",
"appActivity": "com.xueqiu.android.common.MainActivity",
"noReset": 'true',
"dontStopAppOnReset": 'true',
"skipDeviceInitialization": 'true'
}
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desire_cap)
driver.quit()
边栏推荐
- Camera rental management system based on qt+mysql
- C language to realize mine sweeping (simple version)
- Packaging_ Conversion between basic type and string type
- 传统的IO存在什么问题?为什么引入零拷贝的?
- VMware virtual machine setting static IP
- The four stages of cloud computing development have finally been clarified
- Learn together and make progress together. Welcome to exchange
- Vant component used in wechat applet
- Talking about the range of data that MySQL update will lock
- Second understanding permutation and combination
猜你喜欢

图的基本概念以及相关定义

Sequential stack traversal binary tree

Sleep revolution - find the right length of rest

Handling of garbled JMeter response data - three solutions

Builder mode -- Master asked me to refine pills

Basic properties and ergodicity of binary tree

Responsibility chain mode -- through interview

微信小程序中使用vant组件

Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO

红象云腾完成与龙蜥操作系统兼容适配,产品运行稳定
随机推荐
The latest simulated question bank and answers of the eight members (Electrical constructors) of Sichuan architecture in 2022
The four stages of cloud computing development have finally been clarified
大一女生废话编程爆火!懂不懂编程的看完都拴Q了
Map跟object 的区别
IDEA Dashboard
Apple doesn't need money, but it has no confidence in its content
Shrimp skin test surface treated
[普通物理] 光栅衍射
Set up your own website (14)
Stackoverflow annual report 2022: what are developers' favorite databases?
Batch capitalization of MySQL table names
Nifi fast authentication configuration
After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked
Basic concepts and definitions of Graphs
图的基本概念以及相关定义
Common member methods of the calendar class
Leetcode (146) - LRU cache
Prototype mode -- clone monster Army
Dongyuhui is not enough to bring goods to "rescue" live broadcast
Camera rental management system based on qt+mysql