最近有一些学习使用 appium 的同学在尝试使用它的 exe / app 中的 Inspector 功能时出错,因此在这里说明一下如何让 Inspector 工具能正常工作。

演示环境

虽然演示环境使用的是 mac ,但里面对于 Android 的参数设置是和 windows exe 通用的。

什么是 Inspector 工具

Inspector 工具的作用是通过截图查看元素对应节点,进而更加直观地获取到合适的元素定位器。在可以工作的情况下,它的界面如下 ( mac 上 appium.app 的 Inspector):

它主要由两部分组成。左侧是当前屏幕的节点树(类似于 driver.getSource() 返回的结果),右侧是当前屏幕的截图 ( driver.getScreenShot() ) 辅以能标明被选中节点所指的元素位置的红色方框。

它设计用途是通过获取当前屏幕的节点树及截图,让用户直观地看到节点树的节点对应屏幕的哪个元素,并辅以简单的录制脚本功能( mac 版录制功能较多,windows 版目前相对少很多)

Inspector 的使用前提

如上面所说,Inspector 依靠 driver 的 getSource()getScreenShot() 方法获取截图及节点树,因此它的使用前提是你已经建立了 session 。

建立 session 有两种方法:

1、在你的脚本中使用合适的 caps 建立 WebDriver 实例。

2、在启动 appium server 时加入建立 session 所需参数及 --pre-launch

第一种相信能用 appium 跑通脚本的都知道如何使用。但每次都需要启动脚本才能用 Inspector 略嫌麻烦,因此我这里主要介绍第二种方法。

在图形化界面中建立 session

在 mac 版的 appium.app 的界面中,有两个设置各平台参数的菜单:

注意,虽然这里设置的值名称看起来和用例里的 caps 差不多,但这里设置的其实是 server arguments

对于建立 session ,我们必须设定的参数有:

记得要在你设定了的参数前打钩才是生效的哦。

然后我们在 General Settings 里面勾选 Pre-launch application:

最后点击 Launch 。然后 appium server 就会在启动时按照指定参数自动根据设定的参数开启 session 。这样你就能直接使用 Inspector 工具了。

附录

为了方便大家后面出错后查错,附上正常 Launch 后能直接打开 Inspector 查看元素时的所有 log(均使用模拟器)。

Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' lib/server/main.js --command-timeout "7200" --pre-launch --platform-version "8.3" --platform-name "iOS" --app "/Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app" --device-name "iPhone 6" --native-instruments-lib

info: [debug] Starting Appium in pre-launch mode

info: Pre-launching app

info: [debug] Using local app from command line: /Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app

info: [debug] Creating new appium session afd48ecc-4f20-4e42-a0c3-99f76d9a4548

info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder

info: [debug] Setting Xcode version

info: [debug] Setting iOS SDK Version

info: [debug] Getting sdk version from xcrun with a timeout

info: [debug] iOS SDK Version set to 8.3

info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports

info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.3","iOSSDKVersion":"8.3","deviceName":"iPhone 6","platformVersion":"8.3"}

info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.3 Simulator)'
info: [debug] iOS sim UDID is E23DE92A-B6B1-4AEF-9632-4DA8DD7CE630

info: [debug] Detecting automation tracetemplate

info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML

`parseFileSync()` is deprecated. Use `parseStringSync()` instead.

info: [debug] Could not parse plist file (as XML) at /Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings; assuming it doesn't exist
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/hengjiechen/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"sendKeyStrategy":"oneByOne"}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
...

info: [debug] Dynamic bootstrap path: /Users/hengjiechen/Library/Application Support/appium/bootstrap/bootstrap-a4a902c9cce7b6cb.js
info: [debug] Reusing dynamic bootstrap: /Users/hengjiechen/Library/Application Support/appium/bootstrap/bootstrap-a4a902c9cce7b6cb.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.3","iOSSDKVersion":"8.3","deviceName":"iPhone 6","platformVersion":"8.3"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.3 Simulator)'
info: [debug] We're on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.3","iOSSDKVersion":"8.3","deviceName":"iPhone 6","platformVersion":"8.3"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.3 Simulator)'
info: [debug] Parsed app Info.plist (as binary)

info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons

info: [debug] Cleaning sim data files

info: [debug] Executing: xcrun simctl erase E23DE92A-B6B1-4AEF-9632-4DA8DD7CE630

info: [debug] Cleaning app data files

warn: Applications directory /Users/hengjiechen/Library/Developer/CoreSimulator/Devices/E23DE92A-B6B1-4AEF-9632-4DA8DD7CE630/data/Containers/Data/Application doesn't exist. Have you run this simulator before?

warn: Applications directory /Users/hengjiechen/Library/Developer/CoreSimulator/Devices/E23DE92A-B6B1-4AEF-9632-4DA8DD7CE630/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture

info: [debug] Not pre-launching simulator
info: [debug] No device id or app, not installing to real device.
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments

info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (8.3 Simulator)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (8.3 Simulator)" /Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app -e UIASCRIPT "/Users/hengjiechen/Library/Application Support/appium/bootstrap/bootstrap-a4a902c9cce7b6cb.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {"global":90000}

info: [debug] [INST] Waiting for device to boot...

info: Instruments is ready to receive commands

info: [debug] Instruments launched. Starting poll loop for new commands.

info: [debug] Setting bootstrap config keys/values
info: [debug] Pushing command to appium work queue: "target = $.target();\nau = $;\n$.isVerbose = true;\n"
info: [debug] Socket data received (2 bytes)
info: [debug] Socket data being routed.
info: [debug] Sending command to instruments: target = $.target();
au = $;
$.isVerbose = true;


info: [debug] [INST] 2015-04-15 15:09:11 +0000 Debug: evaluation finished

info: [debug] [INST] 2015-04-15 15:09:11 +0000 Debug: responding with:
info: [debug] [INST] 2015-04-15 15:09:11 +0000 Debug: Running system command #1: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":true}...

info: [debug] Socket data received (27 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":true}

info: [debug] Setting initial orientation to PORTRAIT
info: [debug] Pushing command to appium work queue: "au.setScreenOrientation('PORTRAIT')"
info: [debug] Sending command to instruments: au.setScreenOrientation('PORTRAIT')

info: [debug] [INST] 2015-04-15 15:09:12 +0000 Debug: Got new command 1 from instruments: au.setScreenOrientation('PORTRAIT')
info: [debug] [INST] 2015-04-15 15:09:12 +0000 Debug: evaluating au.setScreenOrientation('PORTRAIT')

info: [debug] [INST] 2015-04-15 15:09:12 +0000 Debug: target.setDeviceOrientation("1")

info: [debug] [INST] 2015-04-15 15:09:13 +0000 Debug: evaluation finished

info: [debug] [INST] 2015-04-15 15:09:13 +0000 Debug: responding with:
info: [debug] [INST] 2015-04-15 15:09:13 +0000 Debug: Running system command #2: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":"PORTRAIT"}...

info: [debug] Socket data received (33 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":"PORTRAIT"}

info: [debug] Waiting for app source to contain elements
info: [debug] Pushing command to appium work queue: "au.mainApp().getTreeForXML()"
info: [debug] Sending command to instruments: au.mainApp().getTreeForXML()

info: [debug] [INST] 2015-04-15 15:09:14 +0000 Debug: Got new command 2 from instruments: au.mainApp().getTreeForXML()

info: [debug] [INST] 2015-04-15 15:09:14 +0000 Debug: evaluating au.mainApp().getTreeForXML()

info: [debug] [INST] 2015-04-15 15:09:15 +0000 Debug: evaluation finished

info: [debug] [INST] 2015-04-15 15:09:15 +0000 Debug: responding with:d":true,"valid":true,"visible":true,"hint":null,"path":"/0/0","x":0,"y":0,"width":375,"height":667},">":[]}},{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1","x":0,"y":0.6875,"width":375,"height":665.625},">":[{"UIANavigationBar":{"@":{"name":"My To-Do List","label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/0","x":0,"y":24.125,"width":375,"height":51.5625},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/0/0","x":0,"y":0.6875,"width":375,"height":75},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/0/0/0","x":0,"y":75.6875,"width":375,"height":0.5859375},">":[]}}]}},{"UIAButton":{"@":{"name":"Back","label":"Back","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/0/1","x":9.375,"y":37.6015625,"width":24.609375,"height":24.609375},">":[]}},{"UIAStaticText":{"@":{"name":"My To-Do List","label":"My To-Do List","value":"My To-Do List","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/0/2","x":123.6328125,"y":33.5,"width":128.3203125,"height":31.640625},">":[]}},{"UIAButton":{"@":{"name":"Add","label":"Add","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/0/3","x":322.8515625,"y":31.15625,"width":46.875,"height":35.15625},">":[]}}]}},{"UIATableView":{"@":{"name":null,"label":null,"value":"rows 1 to 3 of 3","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1","x":0,"y":0.6875,"width":375,"height":665.625},">":[{"UIATableCell":{"@":{"name":"Buy milk","label":null,"value":"","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/0","x":0,"y":75.6875,"width":375,"height":51.5625},">":[{"UIAStaticText":{"@":{"name":"Buy milk","label":"Buy milk","value":"Buy milk","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/0/0","x":17.578125,"y":75.6875,"width":339.84375,"height":50.9765625},">":[]}}]}},{"UIATableCell":{"@":{"name":"Buy eggs","label":null,"value":"","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/1","x":0,"y":127.25,"width":375,"height":51.5625},">":[{"UIAStaticText":{"@":{"name":"Buy eggs","label":"Buy eggs","value":"Buy eggs","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/1/0","x":17.578125,"y":127.25,"width":339.84375,"height":50.9765625},">":[]}}]}},{"UIATableCell":{"@":{"name":"Read a book","label":null,"value":"","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/2","x":0,"y":178.8125,"width":375,"height":51.5625},">":[{"UIAStaticText":{"@":{"name":"Read a book","label":"Read a book","value":"Read a book","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/1/2/0","x":17.578125,"y":178.8125,"width":339.84375,"height":50.9765625},">":[]}}]}}]}},{"UIAToolbar":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/2","x":0,"y":666.3125,"width":375,"height":51.5625},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/2/0","x":0,"y":665.7265625,"width":375,"height":0.5859375},">":[]}},{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/1/2/1","x":0,"y":666.3125,"width":375,"height":51.5625},">":[]}}]}}]}},{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/2","x":0,"y":0.6875,"width":375,"height":665.625},">":[]}},{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enab
led":true,"valid":true,"visible":true,"hint":null,"path":"/0/3","x":0,"y":0.6875,"width":375,"height":665.625},">":[{"UIAStatusBar":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/3/0","x":0,"y":0.6875,"width":375,"height":23.4375},">":[{"UIAElement":{"@":{"name":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/3/0/0","x":7.03125,"y":0.6875,"width":44.53125,"height":23.4375},">":[]}},{"UIAElement":{"@":{"name":"3 of 3 Wi-Fi bars","label":"3 of 3 Wi-Fi bars","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/3/0/1","x":57.421875,"y":0.6875,"width":15.234375,"height":23.4375},">":[]}},{"UIAElement":{"@":{"name":"11:09 PM","label":"11:09 PM","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/3/0/2","x":158.203125,"y":0.6875,"width":59.765625,"height":23.4375},">":[]}},{"UIAElement":{"@":{"name":"100% battery power","label":"100% battery power","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/3/0/3","x":339.84375,"y":0.6875,"width":29.296875,"height":23.4375},">":[]}}]}}]}}]}}}
info: [debug] [INST] 2015-04-15 15:09:15 +0000 Debug: Running system command #3: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"UIAApplication":{"@":{"name":"ToDoList","label":"ToDoList","value":null,"dom"...

info: [debug] Socket data received (6297 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"UIAApplication":{"@":{"name":"ToDoList","label":"ToDoList","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0","x":0,"y":24.125,"width":375,"height":642.1875},">":[{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enable
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 7200 secs
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: [debug] Non-default server args: {"app":"/Users/hengjiechen/Develop/IOSTutorial/ToDoList/build/Release-iphonesimulator/ToDoList.app","launch":true,"nativeInstrumentsLib":true,"deviceName":"iPhone 6","platformName":"iOS","platformVersion":"8.3","defaultCommandTimeout":7200}
info: Console LogLevel: debug
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' lib/server/main.js --command-timeout "7200" --pre-launch --automation-name "Appium" --platform-name "Android" --platform-version "4.4" --app "/Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk"

info: [debug] Starting Appium in pre-launch mode

info: Pre-launching app
info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from command line: /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk
info: [debug] Creating new appium session 7f9dca21-0764-4c47-982c-127d88383f91
info: Starting android appium
info: [debug] Getting Java version

info: Java version is: 1.8.0_25

info: [debug] Using fast reset? true
info: [debug] Preparing device for session

info: [debug] Checking whether app is actually present
info: [debug] Checking whether adb is present

info: [debug] Using adb from /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb devices

info: [debug] 1 device(s) connected

info: Found device 192.168.56.101:5555
info: [debug] Setting device id to 192.168.56.101:5555
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 wait-for-device

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "echo 'ready'"

info: [debug] Starting logcat capture

info: [debug] Parsing package and activity from app manifest

info: [debug] Checking whether aapt is present

info: [debug] Using aapt from /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt dump badging /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk

info: [debug] badging package: com.chjvps.hengjiechen.chjapp
info: [debug] badging act: com.chjvps.hengjiechen.chjapp.MainActivity
info: [debug] Parsed package and activity are: com.chjvps.hengjiechen.chjapp/com.chjvps.hengjiechen.chjapp.MainActivity
info: [debug] Getting device API level

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "getprop ro.build.version.sdk"

info: [debug] Device is at API Level 19
info: Device API level is: 19

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "getprop persist.sys.language"

info: [debug] Current device persist.sys.language: en

info: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk" "/tmp/com.chjvps.hengjiechen.chjapp" en

info: [debug] No strings.xml for language 'en', getting default strings.xml

info: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk" "/tmp/com.chjvps.hengjiechen.chjapp"

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 push "/tmp/com.chjvps.hengjiechen.chjapp/strings.json" /data/local/tmp

info: [debug] Checking whether aapt is present

info: [debug] Using aapt from /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt dump xmltree /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk AndroidManifest.xml

info: [debug] Set app process to: com.chjvps.hengjiechen.chjapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk.
info: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/verify.jar /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk

info: [debug] App already signed.

info: [debug] Zip-aligning /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/zipalign

info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/zipalign -f 4 /Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk /var/folders/_c/j72s8y7x1cld6t7mvpvtxtnh0000gn/T/appium115315-12453-1pzget8.tmp

info: [debug] MD5 for app is 8cc24b300a7b1f9b2d3b762646b06745

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "ls /data/local/tmp/8cc24b300a7b1f9b2d3b762646b06745.apk"

info: [debug] Getting install status for com.chjvps.hengjiechen.chjapp

info: [debug] Getting device API level
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "getprop ro.build.version.sdk"

info: [debug] Device is at API Level 19

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "pm list packages -3 com.chjvps.hengjiechen.chjapp"

info: [debug] App is installed

info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "am force-stop com.chjvps.hengjiechen.chjapp"

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "pm clear com.chjvps.hengjiechen.chjapp"

info: [debug] Forwarding system:4724 to device:4724

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 forward tcp:4724 tcp:4724

info: [debug] Pushing appium bootstrap to device...

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 push "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/

info: [debug] Pushing settings apk to device...

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/settings_apk/settings_apk-debug.apk"

info: [debug] Pushing unlock helper app to device...

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"

info: Starting App

info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "ps 'uiautomator'"

info: [debug] No matching processes found

info: [debug] Running bootstrap
info: [debug] spawning: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap

info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1

info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1

info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.

info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "dumpsys window"

info: [debug] Screen already unlocked, continuing.

info: [debug] Pushing command to appium work queue: ["getDataDir",{}]

info: [debug] dataDir set to: /data
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data","status":0}
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] Getting device API level
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "getprop ro.build.version.sdk"
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}

info: [debug] Device is at API Level 19

info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.chjvps.hengjiechen.chjapp/com.chjvps.hengjiechen.chjapp.MainActivity"

info: [debug] Waiting for pkg "com.chjvps.hengjiechen.chjapp" and activity "com.chjvps.hengjiechen.chjapp.MainActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb -s 192.168.56.101:5555 shell "dumpsys window windows"

info: [debug] Device launched! Ready for commands

info: [debug] Setting command timeout to the default of 7200 secs

info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: [debug] Non-default server args: {"app":"/Users/hengjiechen/Develop/uiautomator_test/app/chjapp/app/build/outputs/apk/app-debug.apk","launch":true,"platformName":"Android","platformVersion":"4.4","automationName":"Appium","defaultCommandTimeout":7200}
info: Console LogLevel: debug


↙↙↙阅读原文可查看相关链接,并与作者交流