appium server命令行启动
安装
首先保证node.js已经安装并且已配置环境变量,验证的方法是:
C:\Users\beck
λ npm -v
6.4.1
然后使用npm --registry http://registry.npm.taobao.org install appium -g
安装appium server,安装完成后输入appium,能输出版本信息说明已安装好
C:\Users\beck
λ appium
[Appium] Welcome to Appium v1.14.2
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
...
安装appium-doctor,它是用来检测环境的,使用npm --registry http://registry.npm.taobao.org install appium-doctor -g
,安装后这样检测
C:\Users\beck
λ appium-doctor --android
info AppiumDoctor Appium Doctor v.1.11.1
info AppiumDoctor ### Diagnostic for necessary dep
endencies starting ###
info AppiumDoctor ✔ The Node.js binary was found
at: D:\program\nodejs\node.EXE
info AppiumDoctor ✔ Node version is 10.15.3
info AppiumDoctor ✔ ANDROID_HOME is set to: D:\packages\adt-bundle-windows-x86_64-20140702\sdk
info AppiumDoctor ✔ JAVA_HOME is set to: D:\program\Java\jdk1.8.0_171
info AppiumDoctor ✔ adb exists at: D:\packages\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe
info AppiumDoctor ✔ android exists at: D:\packages\adt-bundle-windows-x86_64-20140702\sdk\tools\android.bat
info AppiumDoctor ✔ emulator exists at: D:\packages\adt-bundle-windows-x86_64-20140702\sdk\tools\emulator.exe
info AppiumDoctor ✔ Bin directory of %JAVA_HOME% is set
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
WARN AppiumDoctor ✖ opencv4nodejs cannot be found.
WARN AppiumDoctor ✖ ffmpeg cannot be found
WARN AppiumDoctor ✖ mjpeg-consumer cannot be found.
WARN AppiumDoctor ✖ bundletool.jar cannot be found
info AppiumDoctor ### Diagnostic for optional dependencies completed, 4 fixes possible. ###
info AppiumDoctor
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it
WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'.
WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it. Also consider adding the ".jar" extension into your PATHEXT environment variable in order to fix the problem for Windows
info AppiumDoctor
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor
启动appium server
在cmd中输入appium就可以启动服务,在程序运行的过程中,可以看到服务输出的日志
C:\Users\beck
λ appium
...
[debug] [W3C (4b21d6b2)] Calling AppiumDriver.closeApp() with args: ["4b21d6b2-bca8-4c65-8f88-61d6988e89ea"]
[debug] [ADB] Running 'D:\packages\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.xxzb.fenwoo'
[debug] [W3C (4b21d6b2)] Responding to client with driver.closeApp() result: null
[HTTP] <-- POST /wd/hub/session/4b21d6b2-bca8-4c65-8f88-61d6988e89ea/appium/app/close 200 945 ms - 14
[HTTP]
[HTTP] --> DELETE /wd/hub/session/4b21d6b2-bca8-4c65-8f88-61d6988e89ea
[HTTP] {}
[debug] [W3C (4b21d6b2)] Calling AppiumDriver.deleteSession() with args: ["4b21d6b2-bca8-4c65-8f88-61d6988e89ea"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1587216708361 (21:31:48 GMT+0800 (GMT+08:00))
[Appium] Removing session 4b21d6b2-bca8-4c65-8f88-61d6988e89ea from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [WD Proxy] Matched '/' to command name 'deleteSession'
[debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/8dc43fe7-c40a-444f-a860-b5721980ab6e] with no body
[debug] [WD Proxy] Got response with status 200: "{\"sessionId\":\"8dc43fe7-c40a-444f-a860-b5721980ab6e\",\"status\":0,\"value\":\"Session deleted\"}"
[debug] [ADB] Running 'D:\packages\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.xxzb.fenwoo'
[debug] [Instrumentation] .
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8200
[debug] [ADB] Running 'D:\packages\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward --remove tcp\:8200'
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1587216709302 (21:31:49 GMT+0800 (GMT+08:00))
[debug] [W3C (4b21d6b2)] Received response: null
[debug] [W3C (4b21d6b2)] But deleting session, so not returning
[debug] [W3C (4b21d6b2)] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/4b21d6b2-bca8-4c65-8f88-61d6988e89ea 200 950 ms - 14
[HTTP]
[debug] [Instrumentation] Time: 31.048
[debug] [Instrumentation]
[debug] [Instrumentation] OK (1 test)
...