我是新接触在 ios 真机上自动化测试的,以下是配置详情:
Mobile:4s 版本 IOS7.1.1(11D201)
XCODE:6.2(6C131e)
appium:1.3.7
os x:10.9.5

测试用例则在 Windows 机器上,Appium Server 搭建在 Mac 机上,Mobile 是通过 USB 连接在 Mac 机上。
测试的 app 提前安装在 Mobile 上了。

以下则是传给 appium server 的 capabilities,及相关代码:

///capabilities;
capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.3.7");
capabilities.SetCapability(MobileCapabilityType.PlatformName, MobilePlatform.IOS);
capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "7.1.1");
capabilities.SetCapability(MobileCapabilityType.DeviceName, "ADiPhone 4S");
capabilities.SetCapability(MobileCapabilityType.App, "com.qiyi.iphone");
capabilities.SetCapability(MobileCapabilityType.UDID, "8bfe0b4ff5aleac8981524cf50edc6710041ed2a");

///appium server;
public static Uri MacRemoteUri = new Uri("http://172.18.20.230:4723/wd/hub");

///远程appium server;
DesiredCapabilities cap = Caps.GetiOS7Caps();
Uri serverUrl = AppiumServers.MacRemoteUri;
Driver = new IOSDriver(serverUrl, cap, TimeSpan.FromSeconds(180));

以下则是 Log 日志:

info: Welcome to Appium v1.3.7 (REV 72fbfaa116d3d9f6a862600ee99cf02f6d0e2182)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"appium-version":"1.3.7","platformName":"iOS","platformVersion":"7.1.1","deviceName":"ADiPhone 4S","app":"com.qiyi.iphone","udid":"8bfe0b4ff5aleac8981524cf50edc6710041ed2a"}}
info: Client User-Agent string: undefined
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appium-version
info: [debug] App is an iOS bundle, will attempt to run as pre-existing
info: [debug] Creating new appium session 0357334b-a040-4792-b629-a998fbb3bd11
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.2
info: [debug] Not checking whether simulator is available since we're on a real device
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /usr/local/lib/node_modules/appium/com.qiyi.iphone/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /usr/local/lib/node_modules/appium/com.qiyi.iphone/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings assuming it doesn't exist
info: [debug] Creating instruments
info: On some xcode 6 platforms, instruments-without-delay does not work. If you experience this, you will need to re-run appium with the --native-instruments-lib flag
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/hivs/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {"nodePath":"/usr/local/Cellar/node/0.12.0/bin/node","commandProxyClientPath":"/usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. D...ot manually modify!
info: [debug] Dynamic bootstrap path: /Users/hivs/Library/Application Support/appium/bootstrap/bootstrap-bd23e525087f1d93.js
info: [debug] Reusing dynamic bootstrap: /Users/hivs/Library/Application Support/appium/bootstrap/bootstrap-bd23e525087f1d93.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.2","iOSSDKVersion":"8.2","deviceName":"ADiPhone 4S","platformVersion":"7.1.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'ADiPhone 4S (7.1.1 Simulator)'
info: [debug] Not setting device type since we're on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since we're on a real device
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] On a real device; cannot clean device state
info: [debug] Not setting locale because we're using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole
error: Log capture did not start in a reasonable amount of time
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Log capture did not start in a reasonable amount of time
info: [debug] Error: Log capture did not start in a reasonable amount of time
    at null._onTimeout (/usr/local/lib/node_modules/appium/lib/devices/ios/ios-log.js:137:10)
    at Timer.listOnTimeout (timers.js:110:15)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Log capture did not start in a reasonable amount of time)","origValue":"Log capture did not start in a reasonable amount of time"},"sessionId":null}
info: <-- POST /wd/hub/session 500 10482.361 ms - 234 
info: [debug] Not pre-launching simulator
info: [debug] Creating iDevice object with udid 8bfe0b4ff5aleac8981524cf50edc6710041ed2a
info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 8bfe0b4ff5aleac8981524cf50edc6710041ed2a --bundle com.qiyi.iphone

手机也没有交互相应,请大神帮忙分析一下是什么地方出问题了,非常感谢!


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