hi。又有问题困扰我了。。

公司有个被测 app 是 android.webkit.WebView 类型的,我查了下,貌似 cap.setCapability("device", "android");不支持把?
我尝试改成了 cap.setCapability("device", "selendroid");但是跑了就出错

error:

info: Welcome to Appium v0.12.3

info: Appium REST http interface listener started on 0.0.0.0:4723
   info  - socket.io started

info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.12.3","revision":"c8abd030c0cedcc387532f2aa986fd956e46eb4f"}}}

debug: Appium request initiated at /wd/hub/status

GET /wd/hub/status 200 9ms - 144b

debug: Request received with params: {}

info: Not spawning instruments force-quit watcher since it only works on 10.9 and you have 10.8.5

debug: Appium request initiated at /wd/hub/session

debug: Request received with params: {"desiredCapabilities":{"platform":"MAC","app":"/Users/administrator/Documents/sf.apk","browserName":"","app-package":"com.sharefile.mobile.tablet","device":"selendroid","app-activity":".activities.SFAccountSelectActivity","version":"4.4.2"}}

info: Using local app from desiredCaps: /Users/administrator/Documents/sf.apk

info: Creating new appium session 0c281080-cb86-431f-970c-0ac0e6a0f6b6

info: Starting selendroid server

info: Checking whether selendroid is built yet

info: Selendroid server exists!
info: Preparing device for session

info: Checking whether app is actually present
info: Checking whether adb is present

info: [ADB] Using adb from /Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb

debug: executing: "/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" devices

info: Trying to find a connected android device
info: [ADB] Getting connected devices...

info: [ADB] 1 device(s) connected

debug: executing: "/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 072008a5 wait-for-device

info: Setting device id to 072008a5
info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5)

debug: executing: "/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 072008a5 shell "echo 'ready'"

info: Starting logcat capture

info: Rebuilt selendroid apk does not exist, uninstalling any instances of it on device to make way for new one

debug: executing: "/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb" -s 072008a5 uninstall com.sharefile.mobile.tablet.selendroid

info: Uninstalling com.sharefile.mobile.tablet.selendroid

debug: App was not uninstalled, maybe it wasn't on device?

info: Rebuilt selendroid server does not exist, inserting modified manifest

info: Inserting selendroid manifest

info: Checking whether aapt is present

error: Failed to start an Appium session, err was: Error: Could not find aapt in tools, platform-tools, or build-tools under "/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk"; do you have android SDK installed into this location?

info: Cleaning up appium session
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find aapt in tools, platform-tools, or build-tools under \"/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk\"; do you have android SDK installed into this location?)","origValue":"Could not find aapt in tools, platform-tools, or build-tools under \"/Users/administrator/Downloads/adt-bundle-mac-x86_64-20131030/sdk\"; do you have android SDK installed into this location?"},"sessionId":null}
POST /wd/hub/session 500 1882ms - 532b

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.12.3","revision":"c8abd030c0cedcc387532f2aa986fd956e46eb4f"}}}

debug: Request received with params: {}

GET /wd/hub/status 200 1ms - 144b


看提示貌似是没有 aapt,但是我确认了下,路径下是有这个文件的,,,,

code:

DesiredCapabilities cap = new DesiredCapabilities();
        WebDriver wd = null;
        cap.setCapability(CapabilityType.BROWSER_NAME, "");
        cap.setCapability(CapabilityType.VERSION, "4.4.2");
        cap.setCapability(CapabilityType.PLATFORM, "MAC");//iPhone Simulator  iPad Device  Selendroid
        cap.setCapability("device", "selendroid");
        cap.setCapability("app", "/Users/administrator/Documents/sf.apk");//app.getAbsolutePath()    chromium ContactManager /Users/administrator/Documents/ContactManager.apk
        //cap.setCapability("launch", "true");
        cap.setCapability("app-activity", ".activities.SFAccountSelectActivity");//MainActivity   .ContactManager .activities.SFAccountSelectActivity
        cap.setCapability("app-package", "com.sharefile.mobile.tablet");//com.example.android.contactmanager

        wd = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);

        wd = new Augmenter().augment(wd);
        wd.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);


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