当前位置:   article > 正文

Appium环境搭建(windows10系统)_windows安装appium

windows安装appium

环境依赖
Node.js
Appium
Appium-desktop
Appium-doctor
Appium-Python-Client
Python
JDK
Andriod SDK

相关下载:

百度网盘:

https://pan.baidu.com/s/1l7WixeO1rklvavbU1njh-Q?pwd=jrq0

《全套》安卓手机系列怎么打开开发者人员选项
https://www.bilibili.com/video/BV1Yv411T7jS?p=1


开发者选项 设置 如华为手机 鸿蒙系统,
1.开启   开发者人员选项
设置--》关于手机--》HarmonyOS版本 上面, 连续点7下,


2.纯净模式  关闭。
3.设置--》系统和更新--》开发人员选项

USb调试--开启
仅充电”模式下允许ADB调试--开启(软件可运行开启WIFI连接)
选择USB配置  -》选择 MTP(多媒体传输)


安装Node.js
下载地址:https://nodejs.org/en/download/releases/
注意:Node.js版本要注意与Appium兼容

安装完成后在按键Win+R输入cmd打开Windows 命令提示符,
输入如下命令:

C:\Users\86134>node -v
v20.11.1

C:\Users\86134>npm -v
10.2.4

C:\Users\86134>

说明:
npm(node package manage)是node.js安装包管理工具,类似Python中的pip工具。
如果显示‘npm’不是内部命令提示,则可以管理员省份运行cmd,如果还是失败,则需要检查一下环境变量是否配置,或者重新安装nodejs。
Appium 安装
Appium Server其实可以通过命令 npm install -g appium来安装。不过由于众所周知的网络原因,直接使用这样安装会非常非常慢,甚至会安装失败,所以我们可以使用国内镜像来安装。

镜像设置
npm install -g cnpm --registry=https://registry.npm.taobao.org

appium 安装
使用如下命令来执行安装:
#安装最新版本
 
npm install -g appium

#安装指定版本
cnpm install appium@
2.5.1 -g
npm的包安装分为本地安装(local)、全局安装(global)两种,一般我们推荐使用全局安装。
appium配置
安装完成之后可以使用如下命令查看appium的安装路径

C:\Users\86134>where appium
C:\Program Files\nodejs\node_global\appium
C:\Program Files\nodejs\node_global\appium.cmd

C:\Users\86134>

appium运行

Windows系统搭建Appium 2 和 Appium Inspector 环境
在控制台输入命令 appium即可启动appium服务,appium -v查看版本

C:\Users\86134>appium -v
2.5.1

C:\Users\86134>appium
[Appium] Welcome to Appium v2.5.1
[Appium] The autodetected Appium home path: C:\Users\86134\.appium
[Appium] Attempting to load driver uiautomator2...
[Appium] Attempting to load driver xcuitest...
[Appium] Requiring driver at C:\Users\86134\.appium\node_modules\appium-uiautomator2-driver\build\index.js
[Appium] Requiring driver at C:\Users\86134\.appium\node_modules\appium-xcuitest-driver\build\index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 5.034s
[Appium] XCUITestDriver has been successfully loaded in 5.034s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
[Appium]        http://192.168.3.148:4723/
[Appium]        http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium]   - uiautomator2@3.0.1 (automationName 'UiAutomator2')
[Appium]   - xcuitest@7.1.2 (automationName 'XCUITest')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.

如果输入appium后显示:“appium不是内部或外部命令,也不是可运行的程序或批处理文件” 可以将appium安装的路径 如: “C:\Program Files\nodejs\node_global\”配置到系统环境变量Path中

退出appium
按键 ctrl+c 选择y 即可退出
安装Appium-desktop
下载地址:https://github.com/appium/appium-desktop/releases
上面提到的问题可以使用前面我们已经介绍了Appium Server来解决,Appium-desktop工具其实也封装了Appium server和Node.js依赖环境。
appium-desktop是我们初学者最容易上手的工具,后面课程首先会基于这个工具来讲解!然后再基于appium 命令来讲。

python环境安装配置
见之前的视频教程:3-2 Python 安装与配置
安装成功之后输入命令 python --version看到如下提示即可

C:\Users\86134>python --version
Python 3.10.2

C:\Users\86134>

安装Appium-Python-Client
通过命令: pip install Appium-Python-Client 进行安装。 安装后可以通过如下命令来检测是否安装成功。
输入命令“from appium import webdriver” 回车,如果控制台没有报错,则说明安装成功。C:\Users\86134>python
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> from appium import webdriver
>>>

如果出现如下报错,则说明安装失败
ImportError: No module named 'appium'
ImportError: cannot import name “webdriver”
说明:装Appium-Python-Client安装后的路径一般为:
{Python 安装路径}\Lib\site-packages\appium

JDK安装配置
jdk下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jdk环境变量配置
http://jingyan.baidu.com/article/624e74599e8ad834e8ba5a94.html

win10如何配置JAVA环境变量https://jingyan.baidu.com/article/4d58d5410132d3dcd4e9c0b1.html
安装配置完成后,打开命令提示符窗口,然后输入如下面命令有对应提示说明安装配置成功。

C:\Users\86134>java -version
java version "1.8.0_391"
Java(TM) SE Runtime Environment (build 1.8.0_391-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.391-b13, mixed mode)

C:\Users\86134>

Andriod sdk 安装
下载地址: http://tools.android-studio.org/index.php/sdk
根据自己的PC平台下载对应版本即可。
安装完成后需要配置环境变量:ANDROID_HOME

安装 appium-doctor
appium-doctor可以检测Appium整体依赖环境配置情况。

C:\Windows\system32>npm install appium-doctor -g
npm WARN deprecated phin@2.9.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated authorize-ios@1.2.1: Moved into appium

added 267 packages in 23s

27 packages are looking for funding
  run `npm fund` for details

C:\Users\86134>appium-doctor
WARN AppiumDoctor [Deprecated] Please use appium-doctor installed with "npm install @appium/doctor --location=global"
info AppiumDoctor Appium Doctor v.1.16.2
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: C:\Program Files\nodejs\node.EXE
info AppiumDoctor  ✔ Node version is 20.11.1
info AppiumDoctor  ✔ ANDROID_HOME is set to: C:\Program Files (x86)\Android\android-sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: C:\Program Files\Java\jdk1.8.0_05
info AppiumDoctor    Checking adb, android, emulator, apkanalyzer.bat
info AppiumDoctor      'adb' is in C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
info AppiumDoctor      'android' is in C:\Program Files (x86)\Android\android-sdk\tools\android.bat
info AppiumDoctor      'emulator' is in C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe
info AppiumDoctor      'apkanalyzer.bat' is in C:\Program Files (x86)\Android\android-sdk\platform-tools\apkanalyzer.bat
info AppiumDoctor  ✔ adb, android, emulator, apkanalyzer.bat exist: C:\Program Files (x86)\Android\android-sdk
info AppiumDoctor  ✔ 'bin' subfolder exists under 'C:\Program Files\Java\jdk1.8.0_05'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
info AppiumDoctor  ✔ opencv4nodejs is installed at: C:\Program Files\nodejs\node_global. Installed version is: undefined
info AppiumDoctor  ✔ ffmpeg is installed at: C:\Users\86134\ffmpeg\bin\ffmpeg.EXE. ffmpeg version 2022-02-28-git-7a4840a8ca-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
info AppiumDoctor  ✔ mjpeg-consumer is installed at: C:\Program Files\nodejs\node_global. Installed version is: 2.0.0
info AppiumDoctor  ✔ bundletool.jar is installed at: C:\Program Files (x86)\Android\android-sdk\build-tools\bundletool.jar.JAR
info AppiumDoctor  ✔ gst-launch-1.0.exe and gst-inspect-1.0.exe are installed at: C:\gstreamer\1.0\mingw_x86_64\bin\gst-launch-1.0.exe and C:\gstreamer\1.0\mingw_x86_64\bin\gst-inspect-1.0.exe
info AppiumDoctor ### Diagnostic for optional dependencies completed, no fix possible. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

安装驱动程序

1、安装UIAutomator2,用于安卓设备的驱动程序。cmd窗口输入:appium driver install uiautomator2


2、安装XCUITest,用于iOS设备的驱动程序。cmd窗口输入:appium driver install xcuitest


3、查看是否安装成功,命令:appium driver list
————————————————

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/453386
推荐阅读
相关标签
  

闽ICP备14008679号