Construction of appium automatic test environment

Keywords: npm Python Android github

1. Installation Node.js

Reason: Appium is implemented with nodejs, so node is interpreter
Download address: https://nodejs.org/en/download/releases/
Be careful Node.js Compatible with the version of Appium, you can check: https://github.com/appium/appium/releases

After installation, open cmd to check the installation

remarks:
npm (node package manage ment) is node.js Install package management tools, similar to pip tools in Python.
If 'npm' is not an internal command prompt, you can run cmd by the administrator province. If it still fails, you need to check whether the environment variable is configured or reinstall nodejs.
#2.Appium service installation
Appium Server can be installed by the command npm install -g appium. However, due to well-known network reasons, direct use of this installation will be very slow and even fail, so we can use the domestic image to install.
Attached link: Taobao NPM

2.1 image setting address

npm install -g cnpm --registry=https://registry.npm.taobao.org

Information after completion

C:\Users\Shuqing> npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
C:\Users\Shuqing\AppData\Roaming\npm\cnpm -> C:\Users\Shuqing\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm
+ cnpm@5.2.0
added 764 packages in 63.767s

2.2appium server installation

#Install the latest version
cnpm install -g appium

#Install the specified version
cnpm install appium@1.7.2 -g

Prompt after completion

All packages installed (565 packages installed from npm registry, used 57s, speed 835.67kB/s, json 477(6.16MB), tarball 40.58MB)
[appium@1.8.0] link C:\Users\Shuqing\AppData\Roaming\npm\appium@ -> C:\Users\Shuqing\AppData\Roaming\npm\node_modules\appium\build\lib\main.js

View configuration when finished

C:\Users\Shuqing>where appium
C:\Users\Shuqing\AppData\Roaming\npm\appium
C:\Users\Shuqing\AppData\Roaming\npm\appium.cmd

View version and start service
appium: start service
appium -v: View version

C:\Users\Shuqing>appium -v
1.7.2

C:\Users\Shuqing>appium
[Appium] Welcome to Appium v1.7.2
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

If "appium is not an internal or external command, nor a runnable program or batch file" is displayed after inputting "appium", the Path of appium installation can be configured into the system environment variable Path, such as "C:\Users\Shuqing\AppData\Roaming\npm"

Exit appium
Press ctrl+c to select y to exit

3. Install appium desktop

Download address: https://github.com/appium/appium-desktop/releases
Appium desktop also includes appium server

4. Python environment installation configuration

5. Install appium Python client

Install through the command: PIP install appium Python client.
Enter the command "from appium import webdriver" to check whether the installation is successful
Prompt for successful installation:

C:\Users\Shuqing>python
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from appium import webdriver

Installation failure prompt:

ImportError: No module named 'appium'
ImportError: cannot import name "webdriver"

explain:
The path after installing appium Python client is generally:

{Python installation path} \ lib \ site packages \ appium

6.JDK installation configuration

7. Android SDK configuration

8. Install appium doctor

Appium doctor can detect the configuration of the overall dependency environment of appium.

C:\Users\Shuqing>cnpm install appium-doctor -g

Enter the command in the console: appium doctor sees the following prompt to indicate that the overall environment configuration is successful.

C:\Users\Shuqing>appium-doctor
info AppiumDoctor Appium Doctor v.1.4.3
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: D:\program files\nodejs\node.exe
info AppiumDoctor  ✔ Node version is 6.11.3
info AppiumDoctor  ✔ ANDROID_HOME is set to: E:\Andriod_sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: C:\Program Files\Java\jdk1.8.0_05
info AppiumDoctor  ✔ adb exists at: E:\Andriod_sdk\platform-tools\adb.exe
info AppiumDoctor  ✔ android exists at: E:\Andriod_sdk\tools\android.bat
info AppiumDoctor  ✔ emulator exists at: E:\Andriod_sdk\tools\emulator.exe
info AppiumDoctor  ✔ Bin directory of %JAVA_HOME% is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

Posted by tomash on Wed, 17 Jun 2020 00:53:05 -0700