Macaca Macaca iOS 真机测试

adfghzhang · August 28, 2016 · Last by 大浪 replied at March 15, 2019 · 12240 hits
本帖已被设为精华帖!

为了弄这个真机的测试,一个周末就过去了,特别对不起我孩子,本来一周就只有一天能陪他了,还被我占用了。当成功打开被测app的那一瞬间,心里是很欣慰的。写下此文希望可以帮助到准备跳坑的和还在坑里的朋友。如果觉得有用,请点个赞!!

一、 准备

  • Xcode 7.3
  • Node 4.x+
  • Homebrew
  • cnmp
  • Carthage
  • AppleID
  • Sample-code(js and java)
  • ios-app-bootstrap

二、 环境安装

  • 安装Node
    shell qiandeMac:~ qian$ node -v v4.5.0 qiandeMac:~ qian$ npm -v 2.15.9
  • 安装淘宝NPM(可选,cnpm安装会快一点)
    shell npm install -g cnpm --registry=https://registry.npm.taobao.org qiandeMac:~ qian$ cnpm -v 4.3.2
  • 安装homebrew
    shell ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装macaca
    shell cnpm i macaca-cli -g
  • 安装ios-webkit-debug-proxy
    shell brew install ios-webkit-debug-proxy
  • 安装macaca-ios
    shell cnpm i macaca-ios -g
  • 检查环境
    ```shell qiandeMac:~ qian$ macaca doctor

Node.js checklist:

node env: /usr/local/bin/node
node version: v4.5.0

iOS checklist:

Xcode is installed at: /Library/Developer/CommandLineTools
Xcode Command Line Tools is ready, version: 2343.
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

Android checklist:

JAVA version is 1.8.0_101
JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
ANDROID_HOME is not set

Installed driver list:

ios: 1.0.36


三、iOS模拟器运行测试
-----

- **运行测试**

```shell
cd /macaca-test-sample-master/macaca-test/
macaca run -d macaca-mobile-sample.test.js

四、iOS真机运行测试(用java代码演示ios-app-bootstrap)

1. 打开webdriveragent项目

  • (/usr/local/lib/node_modules/.macaca-ios_npminstall/node_modules/.1.0.22@webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj)

2. Xcode中添加AppleID

Xcode--Prefencens--Accounts

3. 创建iOS Development Singing Identities

Accounts--View Details--iOS Development—Create

4. 给webdriveragentrunner重签名

修改webdriveragentrunner Product Bundle Identifier

然后Build一下,如果Build Successed那么就OK了,如果Build过程中提示有Fix issue 点击它即可。

运行一次测试webdriveragentrunner就会按照到手机上。

macaca server verbose  
@Before  
public void setUp() throws Exception {
JSONObject porps = new JSONObject();
porps.put("autoAcceptAlerts", true);
porps.put("deviceName", "iPhone 6s");
porps.put("platformName", "iOS");
porps.put("version", "9.3.4");
porps.put("udid", "your udid");
porps.put("bundleId", "zx.ios-app-bootstrap");
JSONObject desiredCapabilities = new JSONObject();
desiredCapabilities.put("desiredCapabilities", porps);
driver.initDriver(desiredCapabilities);
driver.sleep(20000);
}
  • Run As Junit Test

    此时运行报错不用管,只要手机上正确安装上webdriveragent即可。

    此时webdriveragentruner是无法运行的,个人证书默认是不被信任的,需要在设备管理中添加信任,流程如图所示:


5. 给ios-app-bootstrap重签名

  • 安装Carthage
brew intall Carthage
cd /ios-app-bootstrap-master
carthage update
  • 打开ios-app-bootstrap项目

修改Product Bundle Identifier

  • Build

此时手机上就会有刚才构建的ios-app-bootstrap(已经信任过该AppleID了,不会出现需要信任的情况)

6. 运行测试

@Before
public void setUp() throws Exception {
JSONObject porps = new JSONObject();
porps.put("autoAcceptAlerts", true);
porps.put("deviceName", "iPhone 6s");
porps.put("platformName", "iOS");
porps.put("version", "9.3.4");
porps.put("udid", "your udid");
porps.put("bundleId", "zx.ios-app-bootstrap");
// porps.put("app", "/Users/qian/Documents/workspace/wd.java/app/dev_Test.ipa");
JSONObject desiredCapabilities = new JSONObject();
desiredCapabilities.put("desiredCapabilities", porps);
driver.initDriver(desiredCapabilities);
driver.sleep(20000);
}

@Test
public void test_case_1() throws Exception {
driver.saveScreenshot("/Users/qian/Documents/workspace/wd.java/app/xx.jpg");
driver.sleep(2000);
String str = driver.source();
System.out.println(str);
}
qiandeMac:~ qian$ macaca server --verbose
>> index.js:17:12 [master] pid:386 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '192.168.1.102',
host: 'qiandeMac.local',
loaded_time: '2016-08-28 20:57:47' }
>> middlewares.js:17:10 [master] pid:386 base middlewares attached
>> router.js:108:10 [master] pid:386 router set
>> webdriver sdk launched
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"bundleId":"zx.ios-app-bootstrap","platformName":"iOS","udid":"your udid","deviceName":"iPhone 6s","version":"9.3.4","autoAcceptAlerts":true}}
>> session.js:47:10 [master] pid:386 Creating session, sessionId: 848a07c9-d475-4658-8690-c603925ed568.
>> xctest-client.js:43:14 [master] pid:386 project path: /usr/local/lib/node_modules/.macaca-ios_npminstall/node_modules/.1.0.22@webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> macaca-ios.js:130:10 [master] pid:386 {
"bundleId": "zx.ios-app-bootstrap",
"platformName": "iOS"
}
>> xctest-client.js:182:12 [master] pid:386 xcode version: 7.3.1
>> xctest-client.js:123:16 [master] pid:386 Waiting for device with UDID your udid to become available...

>> xctest-client.js:155:14 [master] pid:386 2016-08-28 20:59:39.582 xcodebuild[397:4875] [MT] IDETestOperationsObserverDebug: (82E2184B-BB33-473F-8012-3779E90EAEEE) Beginning test session 82E2184B-BB33-473F-8012-3779E90EAEEE with Xcode 7D1014 on target <DVTiOSDevice: 0x7fe2d4f93180> {
deviceSerialNumber: C6KQX25WGRY6
identifier: your udid
deviceClass: iPhone
deviceName: qian”的 iPhone
deviceIdentifier: your udid
productVersion: 9.3.4
buildVersion: 13G35
deviceSoftwareVersion: 9.3.4 (13G35)
deviceArchitecture: arm64
deviceTotalCapacity: 12628783104
deviceAvailableCapacity: 1510371328
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
deviceType: <DVTDeviceType:0x7fe2d4bb1ef0 Xcode.DeviceType.iPhone>
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
} (9.3.4 (13G35))

>> xctest-client.js:155:14 [master] pid:386 2016-08-28 20:59:39.583 xcodebuild[397:5071] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/qian/Library/Developer/Xcode/DerivedData/WebDriverAgent-ecncypxshfwjehdvedwmpomonice/Logs/Test/4EFCB4AB-5AC4-40F0-AC28-C5B65543F847/Session-2016-08-28_20:59:39-vCJ2pD.log

>> xctest-client.js:155:14 [master] pid:386 MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/gq/6nz6r9bj5hvd0n4pr8htrpd80000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/eadba4ed1c4e510e31a10da1b512ad82/your udid/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/qian/Library/Developer/Xcode/DerivedData/WebDriverAgent-ecncypxshfwjehdvedwmpomonice/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/gq/6nz6r9bj5hvd0n4pr8htrpd80000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.gAeiGg/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
dst_ipa: /var/folders/gq/6nz6r9bj5hvd0n4pr8htrpd80000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.gAeiGg/WebDriverAgentRunner-Runner.app_sparse.ipa

>> xctest-client.js:155:14 [master] pid:386 __MDMDirectoryDiff_block_invoke37:1473 calling writeDictToFile with: /var/folders/gq/6nz6r9bj5hvd0n4pr8htrpd80000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.gAeiGg/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> xctest-client.js:155:14 [master] pid:386 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/gq/6nz6r9bj5hvd0n4pr8htrpd80000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.gAeiGg/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> proxy.js:54:14 [master] pid:386 Proxy: /session:POST to http://192.168.1.101:8100/session:POST with body: {"desiredCapabilities":{"bundleId":"zx.ios-app-bootstrap","platformName":"iOS"}}
>> proxy.js:67:16 [master] pid:386 Got response with status 200: {"value":{"sessionId":"B9C774C6-D4C0-499D-853E-8FDFB93F4E04","capabilities":{"device":"iphone","browserName":"ios-app-bootstrap","sdkVersion":"9.3.4","CFBundleIdentifier":"zx.ios-app-bootstrap"}},"...
>> responseHandler.js:43:14 [master] pid:386 Send HTTP Respone to Client: {"
sessionId":"848a07c9-d475-4658-8690-c603925ed568","status":0,"value":"{\"bundleId\":\"zx.ios-app-bootstrap\",\"platformName\":\"iOS\",\"udid\":\"your udid\",\"deviceName\":\"iPhone 6s\",\"version\":\"9.3.4\",\"autoAcceptAlerts\":true}"}
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: POST url: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/timeouts/implicit_wait, jsonBody: {"ms":20000}
>> responseHandler.js:43:14 [master] pid:386 Send HTTP Respone to Client: {"sessionId":"848a07c9-d475-4658-8690-c603925ed568","status":0,"value":null}
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: GET url: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/screenshot, jsonBody: {}
>> proxy.js:54:14 [master] pid:386 Proxy: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/screenshot:GET to http://192.168.1.101:8100/session/B9C774C6-D4C0-499D-853E-8FDFB93F4E04/screenshot:GET with body:
>> proxy.js:67:16 [master] pid:386 Got response with status 200: "{\n \"value\" : \"iVBORw0KGgoAAAANSUhEUgAAAu4AAAU2CAYAAADK1zMGAAAAAXNSR0IArs4c6QAA\\r\\nABxpRE9UAAAAAgAAAAAAAAKbAAAAKAAAApsAAAKbAABu\\/iDeuP8AAEAASURBVHgB\\r\\n7N2Jvy1pXd\\/7DSgyqDihGGdUBBwQERPnC...
>> responseHandler.js:43:14 [master] pid:386 Send HTTP Respone to Client: {"
sessionId":"848a07c9-d475-4658-8690-c603925ed568","status":0,"value":"\"iVBORw0KGgoAAAANSUhEUgAAAu4AAAU2CAYAAADK1zMGAAAAAXNSR0IArs4c6QAA\\r\\nABxpRE9UAAAAAgAAAAAAAAKbAAAAKAAAApsAAAKbAABu/iDeuP8AAEAASURBVHgB\\r\\n7N2Jvy1pXd/7DSgyqDihGGdUBBwQERPnCROMaERR40TiQMSYOCUxaoyzcQAEmRS6\\r\\nm2YUGhAQGwTBoMnNvfEm997E5JWX+WdYtz57dXVXr7PWPtPeveo5+31er/Va++w1\\r\\nVT3Pu6q+v6eeVftk458W0AJaQAtc0QIf/OAHN936t+/n+Xf77nffbPmc3cf8Xwto\\r\\nAS2gBbTAtbbAyfzEk/f/z42bNmCAAQYYYIABBhhgYKUGBPeVdoxCSiHJ..."}
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: POST url: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/timeouts/implicit_wait, jsonBody: {"ms":2000}
>> responseHandler.js:43:14 [master] pid:386 Send HTTP Respone to Client: {"sessionId":"848a07c9-d475-4658-8690-c603925ed568","status":0,"value":null}
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: GET url: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/source, jsonBody: {}
>> proxy.js:54:14 [master] pid:386 Proxy: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568/source:GET to http://192.168.1.101:8100/session/B9C774C6-D4C0-499D-853E-8FDFB93F4E04/source:GET with body: {}
>> proxy.js:67:16 [master] pid:386 Got response with status 200: "{\n \"value\" : {\n \"tree\" : {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bound...
>> session.js:107:14 [master] pid:386 Send HTTP Respone to Client: "
{\n \"value\" : {\n \"tree\" : {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{16, 100}, {343, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 16,\n \"y\" : 100\n },\n \"size\" : {\n \"width\" : 343,\n \"height\" : 20\n }\n },\n \"value\" : \"iOS Bootstrap\",\n \"label\" : \"iOS Bootstrap\",\n \"type\" : \"StaticText\",\n \"name\" : \"iOS Bootstrap\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{16, 150}, {343, 50}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 16,\n \"y\" : 150\n },\n \"size\" : {\n \"width\" : 343,\n \"height\" : 50\n }\n },\n \"value\" : \"please input username\",\n \"label\" : \"\",\n \"type\" : \"TextField\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{16, 210}, {343, 50}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 16,\n \"y\" : 210\n },\n \"size\" : {\n \"width\" : 343,\n \"height\" : 50\n }\n },\n \"value\" : \"please input password\",\n \"label\" : null,\n \"type\" : \"SecureTextField\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{16, 527}, {343, 40}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 16,\n \"y\" : 527\n },\n \"size\" : {\n \"width\" : 343,\n \"height\" : 40\n }\n },\n \"value\" : null,\n \"label\" : \"Login\",\n \"type\" : \"Button\",\n \"name\" : \"Login\",\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 667}, {375, 44}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 666.5}, {375, 0.5}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 666.5\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 0.5\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Image\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 667}, {375, 44}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 667}, {375, 44}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 667}, {375, 44}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 44\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 667}, {375, 44}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 44\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 44\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 44\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Image\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 44\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Toolbar\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Window\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 667}, {375, 0}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 667\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 0\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Window\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 0}, {375, 667}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{0, 0}, {375, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"0\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{0, 0}, {375, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"children\" : [\n {\n \"bounds\" : \"{{6, 0}, {35, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 6,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 35,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"2 of 5 bars, signal strength\",\n \"type\" : \"Other\",\n \"name\" : \"2 of 5 bars, signal strength\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{44, 0}, {48, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 44,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 48,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"中国电信 network\",\n \"type\" : \"Other\",\n \"name\" : \"中国电信 network\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{97, 0}, {13, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 97,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 13,\n \"height\" : 20\n }\n },\n \"value\" : \"SSID\",\n \"label\" : \"3 of 3 WLAN bars\",\n \"type\" : \"Other\",\n \"name\" : \"3 of 3 WLAN bars\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{163, 0}, {52, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 163,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 52,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"下午9:00\",\n \"type\" : \"Other\",\n \"name\" : \"下午9:00\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{270, 0}, {12, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 270,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 12,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"Orientation Locked\",\n \"type\" : \"Other\",\n \"name\" : \"Orientation Locked\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{288, 0}, {9, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 288,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 9,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"Location tracking on\",\n \"type\" : \"Other\",\n \"name\" : \"StandardLocationTrackingOn\",\n \"rawIdentifier\" : \"StandardLocationTrackingOn\"\n },\n {\n \"bounds\" : \"{{303, 0}, {67, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 303,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 67,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"100% battery power, On AC Power\",\n \"type\" : \"Other\",\n \"name\" : \"100% battery power, On AC Power\",\n \"rawIdentifier\" : null\n },\n {\n \"bounds\" : \"{{303, 0}, {31, 20}}\",\n \"isEnabled\" : \"1\",\n \"isVisible\" : \"1\",\n \"rect\" : {\n \"origin\" : {\n \"x\" : 303,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 31,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : \"100% battery power\",\n \"type\" : \"Other\",\n \"name\" : \"100% battery power\",\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Other\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 20\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"StatusBar\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : null,\n \"type\" : \"Window\",\n \"name\" : null,\n \"rawIdentifier\" : null\n }\n ],\n \"rect\" : {\n \"origin\" : {\n \"x\" : 0,\n \"y\" : 0\n },\n \"size\" : {\n \"width\" : 375,\n \"height\" : 667\n }\n },\n \"value\" : null,\n \"label\" : \"ios-app-bootstrap\",\n \"type\" : \"Application\",\n \"name\" : \"ios-app-bootstrap\",\n \"rawIdentifier\" : null\n }\n },\n \"sessionId\" : \"B9C774C6-D4C0-499D-853E-8FDFB93F4E04\",\n \"status\" : 0\n}"
>> responseHandler.js:11:12 [master] pid:386 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session/848a07c9-d475-4658-8690-c603925ed568, jsonBody: {}
>> macaca-ios.js:258:10 [master] pid:386 Stoping iOS driver...
>> macaca-ios.js:284:10 [master] pid:386 iOS driver cleaned up.
>> session.js:80:12 [master] pid:386 Delete session, sessionId: 848a07c9-d475-4658-8690-c603925ed568
>> responseHandler.js:43:14 [master] pid:386 Send HTTP Respone to Client: {"sessionId":"848a07c9-d475-4658-8690-c603925ed568","status":0}
>> xctest-client.js:123:16 [master] pid:386
Exiting...

>> xctest-client.js:131:16 [master] pid:386 bootstrap exit with code: 0, signal: null
>> xctest-client.js:155:14 [master] pid:386 ** BUILD INTERRUPTED **

>> xctest-client.js:163:14 [master] pid:386 xctest client exit with code: null, signal: SIGTERM

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 167 条回复 时间 点赞

强烈支持,不过还是应该找个时间补偿一下小朋友的。_^

点赞,希望帮助到更多人

必须赞,必须顶

恒温 将本帖设为了精华贴 28 Aug 23:43

不用改bundle id也可以的,另外那个webkit proxy感觉也不用装,因为你从头到尾也没用到过

@codeskyblue 是的,ios-webkit-debug-proxy只用在webview部分

向分享者,敬礼! 可惜没mac电脑折腾不了 ios真机. 什么时候win或linux平台 也能鼓捣mac环境下的就好了.

#5楼 @codeskyblue 不改bundleid,Build的时候会有提示啊,说这个identities已经被使用了 好像是这样的,当时没截图

#7楼 @harsayer 可以用虚拟机

#8楼 @adfghzhang 我以前也遇到过,但似乎把keychain里的什么东西,删掉,然后在fix issue一下就好了

#10楼 @codeskyblue 直接改也不费劲,就这样还简单一点

#11楼 @adfghzhang 这样并不是很好,如果你换了一台机器,难道还要每次都告诉别人,把bundle id改下才行吗?

#12楼 @codeskyblue 还望指点,keychain里面要删除什么内容

#13楼 @adfghzhang 这个真不记得了,后来就再也没有遇到过这种问题,包括周围的同事也没有遇到过,都是一遍直接就成功了

  1. 创建iOS Development Singing Identities

Accounts--View Details--iOS Development—Create
这一步我这里下方并没有像你那样显示wda的相关证书呢?

#15楼 @bonnie 这个你Create就行了 因为我之前创建过 所以是已经有证书了

@adfghzhang webdriveragent代码是哪里下载的?

这是企业级证书吧。个人开发者证书怎么还会要选择信任!

#17楼 @huayinwang macaca安装了后就有代码的哦。这个是路径:/usr/local/lib/node_modules/.macaca-ios_npminstall/node_modules/.1.0.22@webdriveragent/WebDriverAgent/

#18楼 @sixleaves 但事实就是个人证书也要信任

@adfghzhang 如果没有的话,那是没有完全安装?

#21楼 @huayinwang macaca doctor看看呢,macaca-ios安装了么

#20楼 @adfghzhang 这个框架也是facebook的webdriveragent。有点凌乱啊,facebook的这个框架和appium底层机制是不一样的么?最后不都是调用instruments的命令。

#23楼 @sixleaves wda是走xctest的哦不是instruments

#24楼 @adfghzhang xctest有什么优势么,能不对第三方app重签名。直接跑么?

#25楼 @sixleaves 优势:支持多线程、速度更快,其他优势请找搜索引擎。还是得重签名。

#24楼 @adfghzhang 多谢指教,这是非侵入式的框架?

#22楼 @adfghzhang 我装完 地址是 /usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/node_modules/webdriveragent

#26楼 @adfghzhang 其实他们底层都是调用UIAutomation这个框架吧。

运行脚本安装webdriveragent时报错, 手机系统 8.3

@AAtest iphone5s 及以上的64位机器,升级系统到最新

#33楼 @xdf 正在升级, 我目前遇到2个问题:
第一: Android_home 环境已经配置 但是doctor提示没有安装, adb命令可以使用.

第二: iOS和electrom驱动安装成功,用npm i macaca-ios -g和npm i macaca-electron -g ,但是谷歌驱动和安卓驱动同样用 npm命令就安装失败

#34楼 @AAtest 你这环境变量一会儿单引号,一会儿双引号,还有没引号的。建议把这些引号去掉,再生效。android驱动失败的问题建议先删除本地npm,再换用淘宝的npm镜像用cnpm i macaca-android -g安装

#25楼 @sixleaves 企业证书的第三方APP没重签名可以跑的,不过要有bundle id。WebDriverAgent需要重签名

bundleid修改后,WebDriverAgent安装时,应用安装不上去,能帮我看下这个是什么原因吗
2、经常报这个错是什么引起的

#35楼 @adfghzhang 以上问题已经解决了,谢谢. 目前还遇到一个问题,ios的webdriveragent怎么也装不上去.没反应 .ios模拟器可以运行官网例子(环境搭建没有问题).

楼主 我build webdriveragentrunner后并没有安装 ,只是build成功

#39楼 @jira 要运行macaca测试才会安装,要不你xcode里面选Build Test

42Floor has been deleted
Coyinper [Topic was deleted] 中提及了此贴 18 Sep 16:26

有个问题请教作者,真机测试,ios跑app自动化,需要先拿到app项目的代码吗?

安装Carthage 这一步是何用意?

#46楼 @jira Carthage类似于maven,给项目先下载依赖的

#28楼 @huayinwang 我的也是!找了半天没找到,还好看到你留言!

@adfghzhang 我在安装webdriveragentrunner时xcode显示build success, 但手机上就是没有安装成功后的图标,似乎又没有成功?

iOS模拟器运行时的错误,大神可以帮我看下吗?百度好久,还是找不到原因。
maraca doctor 无报错

wenbingbingdeMacBook-Air:macaca-test wenbingbing$ macaca run -d macaca-mobile-sample.test.js 
>> webdriver sdk launched
>> module.js:457
throw err;
^

Error: Cannot find module 'macaca-utils'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/wenbingbing/macaca-test-sample/macaca-test/macaca-mobile-sample.test.js:4:9)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at /usr/local/lib/node_modules/macaca-cli/node_modules/mocha/lib/mocha.js:219:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/local/lib/node_modules/macaca-cli/node_modules/mocha/lib/mocha.js:216:14)
at Mocha.run (/usr/local/lib/node_modules/macaca-cli/node_modules/mocha/lib/mocha.js:468:10)
at Object.<anonymous> (/usr/local/lib/node_modules/macaca-cli/node_modules/mocha/bin/_mocha:403:18)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

>> Test completed!

为什么,我build webdriveragentruner 提示 build succeed, 但是手机上什么都没有安装?

我是使用rjb调用jar包的,设置了指定Ip,但返回错误的告诉我是localhost,请问是什么原因
C:\gem1\atk-mobileuihelper_common\keywords\test\atk_mobileuihelper_common>ruby test_configure.rb -v
Run options: -v --seed 52159

Running:

[2016-09-27 19:46:10] INFO Mobileuihelper服务器配置信息为:
[2016-09-27 19:46:10] INFO 参数 : host ---> 200.200.129.162
[2016-09-27 19:46:10] INFO 参数 : port ---> 3456
[2016-09-27 19:46:10] INFO 参数 : platformname ---> ios
[2016-09-27 19:46:10] INFO 参数 : version --->
[2016-09-27 19:46:10] INFO 参数 : platformversion ---> 9.3
[2016-09-27 19:46:10] INFO 参数 : devicename ---> iPhone 6s
[2016-09-27 19:46:10] INFO 参数 : app ---> ios-app-bootstrap.zip
[2016-09-27 19:46:10] INFO 参数 : autoacceptalerts ---> true
[2016-09-27 19:46:10] INFO 参数 : javascriptenable ---> true
[2016-09-27 19:46:10] INFO 参数 : udid --->
[2016-09-27 19:46:10] INFO 参数 : bundleid --->
[2016-09-27 19:46:10] INFO 参数 : browsername ---> electron
org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:3456 refused
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:127)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:360)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:177)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:77)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:95)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at macaca.client.common.Utils.postRequest(Utils.java:89)
at macaca.client.common.Utils.request(Utils.java:135)
at macaca.client.commands.Session.createSession(Session.java:25)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:727)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)

//code
require 'rjb'

module Mobileuihelper

class Macaca_cli

@@driver = nil

def self.init(hash)

if @@driver.nil?
#device_file = File.join(ATT.root, 'config', 'test_device.yml')
#env_cfg = YAML.load_file(device_file)
Rjb::load("C:\Program Files\Java\jre1.8.0_101\lib\ext\macacaclient-1.0.21.jar:fastjson-1.2.17.jar:httpclient-4.3-beat1.jar:org-apache-commons-logging.jar",jvmargs=[])
class_json = Rjb::import('com.alibaba.fastjson.JSONObject')
porps = class_json.new
class_macac_cli = Rjb::import('macaca.client.MacacaClient')
@@driver = class_macac_cli.new
porps.put("host",hash[:host])
porps.put("port",hash[:port])
porps.put("autoAcceptAlerts",hash[:autoacceptalerts])
porps.put("browserName",hash[:browsername])
porps.put("platformName",hash[:platformname])
porps.put("version",hash[:version])
porps.put("platformVersion",hash[:platformversion])
porps.put("deviceName",hash[:devicename])
porps.put("javascriptEnable",hash[:javascriptenable])
porps.put("app",hash[:app])
porps.put("udid",hash[:udid])
porps.put("bundleId",hash[:bundleid])
desiredcapabilities = class_json.new
desiredcapabilities.put("desiredCapabilities",porps)
@@driver.initDriver(desiredcapabilities)
end
end

end

end

#52楼 @snowboy 我也遇到这个问题 ,难道要运行测试

#54楼 @praguepp @snowboy 是的build 成功并不会安装wda到手机,你要test才会安装到手机,直接运行macaca test脚本也会安装

#51楼 @winterwen 不知道你是否在/macaca-test-sample-master目录下先执行npm i安装modules没有

#53楼 @praguepp
已解决,发现1.0.21包上赋值host,ip不生效,目前是手动修改代码编译使用。 @adfghzhang

系统是osx ei

1.android
安装的时候遇到npm i uiautomator-client 安装不上的问题,能否直接提供jar包或解决方法?网上找了1天没找到解决方法。

responseHandler.js:60:14 [master] pid:32510 Error: Command failed: /Applications/Android\ Studio.app/sdk/platform-tools/adb -s 4df1a1d56ba07f0f push /usr/local/lib/node_modules/macaca-android/node_modules/uiautomator-client/bin/uiautomator-bootstrap.jar /data/local/tmp

cannot stat '/usr/local/lib/node_modules/macaca-android/node_modules/uiautomator-client/bin/uiautomator-bootstrap.jar': No such file or directory

安装日志:
praguepps-MacBook-Air:uiautomator-client praguepp$ sudo npm i uiautomator-client

Password:

uiautomator-client@1.0.25 install /Users/praguepp/Downloads/uiautomator-client-master/node_modules/.1.0.25@uiautomator-client/node_modules/uiautomator-client

node ./scripts/build.js

/Users/praguepp/Downloads/uiautomator-client-master/node_modules/.1.0.25@uiautomator-client/node_modules/uiautomator-client/scripts/build.js:178

throw e;

^

Error: $JAVA_HOME is not set

at checkJavaHome.then.catch.then.then.catch.then.std (/Users/praguepp/Downloads/uiautomator-client-master/node_modules/.1.0.3@java-home/lib/java-home.js:89:25)

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/Cellar/node/6.6.0/bin/node" "/usr/local/bin/npm" "i" "uiautomator-client"

npm ERR! node v6.6.0

npm ERR! npm v3.10.7

npm ERR! code ELIFECYCLE

npm ERR! uiautomator-client@1.0.25 install: node ./scripts/build.js

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the uiautomator-client@1.0.25 install script 'node ./scripts/build.js'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the uiautomator-client package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR! node ./scripts/build.js

npm ERR! You can get information on how to open an issue for this project with:

npm ERR! npm bugs uiautomator-client

npm ERR! Or if that isn't available, you can get their info via:

npm ERR! npm owner ls uiautomator-client

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR! /Users/praguepp/Downloads/uiautomator-client-master/node_modules/.1.0.25@uiautomator-client/npm-debug.logi
//debug.log

  1. ios ios:则是project team 问题无法解决。

我的general是正常的
Testing

Signing
Automatically manage signing //勾选
Team deng daiel(Personal Team)
Provisioning Profile Xcode Managed Profile
Signing Certificate iphone Developer:xxxxx

xctest-client.js:156:14 [master] pid:31511 2016-09-28 17:39:40.882 xcodebuild[31517:808582] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/praguepp/Library/Developer/Xcode/DerivedData/WebDriverAgent-earnspoghlsscjbxlmzvvcsmvulx/Logs/Test/81CCEEDB-E582-4AEA-BB0F-BD6F652B6B2C/Session-WebDriverAgentRunner-2016-09-28_173939-Jn8XE6.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/praguepp/Library/Developer/Xcode/DerivedData/WebDriverAgent-earnspoghlsscjbxlmzvvcsmvulx/Logs/Test/81CCEEDB-E582-4AEA-BB0F-BD6F652B6B2C/Session-WebDriverAgentRunner-2016-09-28_173939-Jn8XE6.log}

xctest-client.js:156:14 [master] pid:31511

Testing failed:

xctest-client.js:156:14 [master] pid:31511 Signing for "IntegrationApp" requires a development team. Select a development team in the project editor.

Code signing is required for product type 'Application' in SDK 'iOS 10.0'

** TEST FAILED **

#54楼 @praguepp
换个windows安装 uiautomator-client 也是一样,这个包依赖什么?
C:\Users\Administrator.PC--20150905VON\Downloads\uiautomator-client-master\uiautomator-client-master> npm i uiautomator-client --save
npm WARN install Refusing to install uiautomator-client as a dependency of itself

问题已解决,感谢CoderToSurvive

@adfghzhang ,我这边有企业版本iOS账号了,general都配置了企业开发团队,但仍然提示错误,如何解决?

xctest-client.js:156:14 [master] pid:31511 Signing for "IntegrationApp" requires a development team. Select a development team in the project editor.

Code signing is required for product type 'Application' in SDK 'iOS 10.0'

@adfghzhang ,重新配置解决了,2个地方要配置

把runner重签名后,发现安装上去的包名还是com.apple.test.WebDriverAgentRunner-Runner。但是已经改了Bundle ID了,好奇怪啊,快被折腾死鸟

#64楼 @sixleaves 怎么是apple呢 默认应该是facebook啊

#65楼 @adfghzhang 不知道啊我用ideviceinstall -l查看安装的应用, 看到的包名就是这个。

Runner是我后面自己改的显示名,不知道是不是macaca框架再做签名的时候的一种规范。 @adfghzhang

觉得文档太少了,被整得快疯了😂 😂 😂 @adfghzhang

#68楼 @sixleaves 这个你可以运行一下sample看看是否报错。要不Q279434294

#63楼 @praguepp 要修改什么配置呢

我build的时候报错了,我看了一下,npm i macaca-ios -g里面确实没有WebDriverAgentTests。 我能不能把github上https://github.com/facebook/WebDriverAgentcopy下面直接放进去?的那个

error: could not read data from '/usr/local/lib/node_modules/.macaca-ios_npminstall/node_modules/.1.0.28@webdriveragent/WebDriverAgent/WebDriverAgentTests/IntegrationApp/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

此问题已解决。

楼主能说下你的 iPhone 手机系统版本和型号吗?我在 iPhone 6s(9.3.3)上无法正常启动 WDA。已经在【设备管理】里添加信任了。

看了一半 良心贴 先来回帖

#72楼 @canty 弄这个帖子的时候跟你的版本一样,xcode7.3.1。不能启动WDA可以逛逛其它帖子,或者更新macaca版本和驱动

75Floor has been deleted

ios-app-bootstrap源码编译的包有两个问题
一个crash,一个toast不显示,我给改了一下,需要的下载
链接: https://pan.baidu.com/s/1bp7QVQB 密码: m84g

#71楼 @fengytn 我也遇到这样的错误,直接放进去可以吗?

小马 [Topic was deleted] 中提及了此贴 28 Oct 15:30
马尾 [Topic was deleted] 中提及了此贴 11 Nov 16:56
chengliang lei [Topic was deleted] 中提及了此贴 11 Nov 17:21

运行webdriveragent的时候,有如下报错,请问应该如何解决?多谢,xcode8.1

#81楼 @u1449648501 有些依赖文件,你没有下载下来,你要在WDA目录下执行 ./Scripts/bootstrap.sh

@Tank007 @u1449648501 不需要的,直接 cnpm i macaca-ios -g 即可

@xdf 你好,我在mac上运行模拟器出现问题: Error: Command failed: xcrun --sdk iphonesimulator --show-sdk-version 我现在系统10.12,Xcode Version 8.0 (8A218a) ,下载您在github上最新的测试代码,但是运行出来说模拟器有问题。但是我看到在最新的测试用例中,是没有模拟器中iOS版本的限制的,我也尝试把Xcode7.3上的模拟器SDK拷贝到Xcode中,但是仍然不起作用,能不能帮我看下,谢谢了!

@chenyang.neil 把没用的simulator都删了

@xdf 是将模拟器的SDK文件夹全删了?

@xdf 我已经把没用的模拟器删除了,但是现在运行还是说 Error: Command failed: xcrun --sdk iphonesimulator --show-sdk-version....

xcrun --sdk iphonesimulator --show-sdk-version 没问题的啊,我系统10.1

@xdf 请问一下每个测试用例都要重新安装app吗,这样是不是太浪费时间了,有什么办法可以解决

reuse

Coyinper python ios 真机测试 中提及了此贴 22 Nov 00:05

楼主大神,请教个问题啊:按照您帖子里面步骤,到给手机安装webdriveragentrunner,之前都是正确。安装webdriveragentrunner时,手机没有安装成功,然后看了了日志是这样的一段:
testmanagerd handled session request.
Waiting for test process to launch.
Test operation failure: Test operation was canceled.
_finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled." UserInfo={NSLocalizedDescription=Test operation was canceled.} didCancel: 1

请问这个问题该怎么解决啊?

@aifeiyan 回复楼上,还有一段报错日志:

xctest-client.js:163:14 [master] pid:11879 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:162:14 [master] pid:11879 Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.
Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.1'
这个是什么情况啊?还请楼主有时间帮忙看下,辛苦~

#97楼 @aifeiyan 你这问题我没遇到过,不过看日志应该是跟你的签名有关。具体可以咨询一下iOS开发的或者去macaca的github提issue

@adfghzhang 你好,build成功后,我运行测试,webdriveragentruner并没有在真机上安装是什么原因呢?测试代码还是在mac的模拟器上跑了,并没有在真机上面有任何操作

小马 MacOs 环境安装配置 macaca 总结记 中提及了此贴 29 Nov 14:46

[求助] WebDriverAgent编译不通过,错误如下:
error: unknown warning option '-Wno-double-promotion'; did you mean '-Wno-documentation'? [-Werror,-Wunknown-warning-option]
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

#100楼 @FrendEr 你的测试脚本里面没有改为真机运行,所以继续跑模拟器了

#102楼 @longmmh 请检查一下相关的依赖是否已经用Carthage安装了

#105楼 @xdf 我使用的xcode7.2,不是xcode 8,安装Carthage并update之后,仍然无法运行模拟器sample。从log来看,应该是xcode编译存在问题:>> xctest-client.js:170:14 [master] pid:2464 2016-12-01 15:14:30.956 xcodebuild[2478:57797] Connection peer refused channel request for "dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"; channel canceled

@longmmh 升级,看中文文档

#107楼 @xdf 升级xcode8之后可用,非常感谢

@Before
public void setUp() throws Exception {
JSONObject porps = new JSONObject();
porps.put("autoAcceptAlerts", true);
porps.put("deviceName", "iPhone 6s");
porps.put("platformName", "iOS");
porps.put("version", "9.3.4");
porps.put("udid", "your udid");
porps.put("bundleId", "zx.ios-app-bootstrap");
// porps.put("app", "/Users/qian/Documents/workspace/wd.java/app/dev_Test.ipa");
JSONObject desiredCapabilities = new JSONObject();
desiredCapabilities.put("desiredCapabilities", porps);
driver.initDriver(desiredCapabilities);
driver.sleep(20000);
}
请问这个里面的driver是那个jar中的?或者这个driver是怎么定义的

#107楼 @xdf 楼主 可以麻烦你把定义driver的代码贴出来吗?不知道你用的是什么框架,

志雄 [Topic was deleted] 中提及了此贴 06 Dec 17:28

pid:16570 Trying to start wda server...

wda 好像起不来,知道怎么解决吗?

#107楼 @xdf 您好,请问刚才升级到最新的版本,用例就跑不了了呢,运行demo也是报这个错; throw err;
^

Error: Cannot find test framework "mocha" in E:\macaca-test-sample-master\node_modules
at Runner.initFramework (C:\Users\XIONGFEI\AppData\Roaming\npm\node_modules\macaca-cli\lib\run\index.js:55:11)
at co.then (C:\Users\XIONGFEI\AppData\Roaming\npm\node_modules\macaca-cli\lib\run\index.js:41:10)
at process._tickCallback (internal/process/next_tick.js:103:7)

#113楼 @fffhigh0315 npm i mocha -g

webdriveragent 无法转到手机里,请问知道怎么解决吗?

#115楼 @t137983656 贴报错信息吧

macaca run -d macaca-mobile-sample.test.js
(node:7375) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:7375) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:7375) DeprecationWarning: Calling an asynchronous function without callback is deprecated.

webdriver sdk launched
/usr/local/lib/node_modules/macaca-cli/lib/run/index.js:44
throw err;
^

Error: Cannot find test framework "mocha" in /Users/h/Desktop/AutoTest/macaca-test-sample/macaca-test/node_modules
at Runner.initFramework (/usr/local/lib/node_modules/macaca-cli/lib/run/index.js:71:13)
at co.then (/usr/local/lib/node_modules/macaca-cli/lib/run/index.js:41:10)
at process._tickCallback (internal/process/next_tick.js:103:7)

当我执行 完你的 这条指令以后 npm i mocha -g 还是报相同的错,这是什么情况?

#117楼 @AllocAndInit 在macaca-test-sample目录执行macaca run -d ./macaca-test/macaca-mobile-sample.test.js

#118楼 @adfghzhang 问题已解决,多谢楼主

请问楼主, Macaca 支持iOS真机远程测试吗?就是是否可以不用 USB 连接电脑完成自动化测试

我 真机 inspector 可以运行, 修改了签名 ,可以成功;然后我修改 macaca-ios下的webDriverAgent,进行真机运行测试的时候却不可以,错误信息如下,帮我看一下:


T E S T S

Running macaca.client.IosSampleTest
404
Response content:Not Found
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.65 sec <<< FAILURE!
test_case_1(macaca.client.IosSampleTest) Time elapsed: 0.155 sec <<< ERROR!
com.alibaba.fastjson.JSONException: syntax error, pos 3, json : Not Found
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1361)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1268)
at com.alibaba.fastjson.JSON.parse(JSON.java:137)
at com.alibaba.fastjson.JSON.parse(JSON.java:128)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:201)
at macaca.client.common.Utils.postRequest(Utils.java:95)
at macaca.client.common.Utils.request(Utils.java:135)
at macaca.client.commands.Session.createSession(Session.java:25)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:781)
at macaca.client.IosSampleTest.setUp(IosSampleTest.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

test_case_1(macaca.client.IosSampleTest) Time elapsed: 0.156 sec <<< ERROR!
java.lang.NullPointerException
at macaca.client.common.Utils.deleteRequest(Utils.java:111)
at macaca.client.common.Utils.request(Utils.java:137)
at macaca.client.commands.Session.delSession(Session.java:35)
at macaca.client.MacacaClient.quit(MacacaClient.java:801)
at macaca.client.IosSampleTest.tearDown(IosSampleTest.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Results :

Tests in error:
test_case_1(macaca.client.IosSampleTest): syntax error, pos 3, json : Not Found
test_case_1(macaca.client.IosSampleTest)

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.872 s
[INFO] Finished at: 2016-12-09T16:59:38+08:00
[INFO] Final Memory: 16M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project macacatestsample: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/Minstone/Desktop/macaca-test-sample-java/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
MinstonedeMacBook-Pro:macaca-test-sample-java Minstone$

#120楼 @t137983656 看你这报错应该是你的maven项目缺少了依赖包,工程没报错么?

#121楼 @adfghzhang apache-maven-3.3.9 这个是我装的maven版本,直接官网下的;我运行macaca doctor也都是全绿的,模拟器也能跑,就是真机运行测试跑步起来

macaca doctor 输出如下:(没搞安卓)

MinstonedeMacBook-Pro:~ Minstone$ macaca doctor

macaca-doctor version: 1.0.28

Node.js checklist:

node env: /usr/local/bin/node
node version: v6.9.2

iOS checklist:

Xcode is installed at: /Applications/Xcode.app/Contents/Developer
Xcode Command Line Tools is ready, version: 2345.1.
iproxy[usbmuxd] is installed at: /usr/local/bin/iproxy
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

Android checklist:

JAVA version is 1.8.0_101
JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
ANDROID_HOME is not set

Installed driver list:

electron: 1.1.4
ios: 1.0.51

你好,请问ios模拟器上跑ipa包不断重启,进不去app,怎么解决啊,求教

楼主,执行carthage update 报错,*** xcodebuild output can be found in /var/folders/b2/1m_p7q19731ft3vf8yfy2vlc0000gn/T/carthage-xcodebuild.oq5mSK.log
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire tvOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire macOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire watchOS" in Alamofire.xcworkspace
*** Building scheme "CryptoSwift" in CryptoSwift.xcworkspace
** CLEAN FAILED **

The following build commands failed:
Check dependencies
(1 failure)
** BUILD FAILED **

The following build commands failed:
Check dependencies
(1 failure)
A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/lihr/macaca-test-sample/app/ios-app-bootstrap-master/Carthage/Checkouts/CryptoSwift/CryptoSwift.xcworkspace -scheme CryptoSwift -configuration Release -sdk watchos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** CLEAN FAILED **
请问这个该如何解决

#124楼 @xtt_weath 貌似是签名没搞好 code sign

#122楼 @t137983656 我的问题已经解决是, 是 ios-deploy 发生错误造成的,重新安装 brew install ios-deploy,就解决了

请问ios-app-bootstrap.xcodeproj在哪里获取的?

error: The following binaries use incompatible versions of Swift:
/Users/george/Library/Developer/Xcode/DerivedData/ios-app-bootstrap-effyduyiopszpzbbrhteqfglzqtk/Build/Products/Debug-iphoneos/ios-app-bootstrap.app/Frameworks/Alamofire.framework/Alamofire
/Users/george/Library/Developer/Xcode/DerivedData/ios-app-bootstrap-effyduyiopszpzbbrhteqfglzqtk/Build/Products/Debug-iphoneos/ios-app-bootstrap.app/ios-app-bootstrap

我carthage update 后报错,请问怎么破?

build的时候报的错。
已解决。

index.js:17:12 [master] pid:39060 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '10.0.0.114',
host: 'GeorgeZ.local',
loaded_time: '2016-12-21 18:44:01' }
middlewares.js:17:10 [master] pid:39060 base middlewares attached
router.js:127:10 [master] pid:39060 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:39060 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"deviceName":"iPhone 7","platformName":"iOS","autoAcceptAlerts":false,"reuse":3,"udid":"0edb9cee7e8f607d7a0c9e76d6fbd7483d259eb3","bundleId":"georgeZ.ios-app-bootstrap"}}
session.js:47:10 [master] pid:39060 Creating session, sessionId: b7b14f77-32a8-450e-a8ea-c34e6205c303.
ios-deploy
macaca-ios.js:229:12 [master] pid:39060 App "georgeZ.ios-app-bootstrap" is already installed.
xctest-client.js:56:14 [master] pid:39060 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
macaca-ios.js:145:10 [master] pid:39060 {
"bundleId": "georgeZ.ios-app-bootstrap",
"platformName": "iOS"
}
macaca-ios.js:149:12 [master] pid:39060 Trying to start wda server...
xctest-client start with port: 8900
xctest-client.js:233:14 [master] pid:39060 xcode version: 8.2
WebDriverAgent version: 1.0.41
xctest-client.js:170:14 [master] pid:39060 2016-12-21 18:44:10.039 xcodebuild[39075:9193502] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/george/Library/Developer/Xcode/DerivedData/WebDriverAgent-earnspoghlsscjbxlmzvvcsmvulx/Logs/Test/F11ABEA0-95DD-4544-8C78-528843F306BD/Session-WebDriverAgentRunner-2016-12-21_184410-ciy2Dy.log

xctest-client.js:171:14 [master] pid:39060 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:39060 2016-12-21 18:44:10.039 xcodebuild[39075:9193499] [MT] IDETestOperationsObserverDebug: (03F284CF-D8E7-45AC-8F67-D827AE71B330) Beginning test session WebDriverAgentRunner-03F284CF-D8E7-45AC-8F67-D827AE71B330 at 2016-12-21 18:44:10.037 with Xcode 8C38 on target {
deviceSerialNumber: DNPSDEZGHG71
identifier: 0edb9cee7e8f607d7a0c9e76d6fbd7483d259eb3
deviceClass: iPhone
deviceName: GeorgeZ
deviceIdentifier: 0edb9cee7e8f607d7a0c9e76d6fbd7483d259eb3
productVersion: 10.2
buildVersion: 14C92
deviceSoftwareVersion: 10.2 (14C92)
deviceArchitecture: arm64
deviceTotalCapacity: 121850691584
deviceAvailableCapacity: 101338120192
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
deviceType: <0x7fb2cc64cca0 xcode.devicetype.iphone>
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
} (10.2 (14C92))

xctest-client.js:171:14 [master] pid:39060 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:39060 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/ql/l977ttgj1jz4730n1xt13xlc0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/74f04c2f4a7278e3fdac2d90f0299b42/0edb9cee7e8f607d7a0c9e76d6fbd7483d259eb3/ManifestCache.plist

xctest-client.js:171:14 [master] pid:39060 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:39060 2016-12-21 18:44:19.283 xcodebuild[39075:9193499] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

xctest-client.js:171:14 [master] pid:39060 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:39060
Testing failed:

xctest-client.js:171:14 [master] pid:39060 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:39060 Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
** TEST FAILED **

求助!!T_T

@praguepp
1.android 安装的时候遇到npm i uiautomator-client 安装不上的问题?
这个问题你是怎么解决的呢

#133楼 @huangejuan npm i macaca-android 会自动安装上依赖包的,如果npm安装失败建议换cnpm

@adfghzhang
用cnpm来安装的话会报异常,
Error: build failed
at ChildProcess. (D:\workspace\macaca\nodejs\node-global\node_modules\macaca-android\node_modules.1.0.4@ant-build\l
ib\ant-build.js:111:16)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
D:\workspace\macaca\nodejs\node-global\node_modules\macaca-android\node_modules.0.1.16@unlock-apk\script\build.js:28
throw e;
^

Error: build failed
at ChildProcess. (D:\workspace\macaca\nodejs\node-global\node_modules\macaca-android\node_modules.1.0.4@ant-build\l
ib\ant-build.js:111:16)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
Error: post install error, please remove node_modules before retry!
Run "C:\WINDOWS\system32\cmd.exe /d /s /c node ./script/build.js" error, exit code 1
at ChildProcess.proc.on.code (D:\workspace\macaca\nodejs\node-global\node_modules\cnpm\node_modules\runscript\index.js:67:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npminstall version: 2.15.0

#135楼 @huangejuan java环境变量和ant装了么,没有装的话先安装一下jdk1.8,还有问题的话贴一下macaca doctor的信息

@adfghzhang 都安装了,还是报这个异常
Node.js checklist:

node env: D:\workspace\macaca\nodejs\node.exe
node version: v6.9.1

Android checklist:

JAVA version is 1.8.0_31
JAVA_HOME is set to D:\workspace\Java\jdk1.8.0_31
ANDROID_HOME is set to D:\workinformation\android\sdk\android-sdk-windows
Platforms is set to D:\workinformation\android\sdk\android-sdk-windows\platforms\android-24
Android tools is set to D:\workinformation\android\sdk\android-sdk-windows\tools\android.bat
ADB tool is set to D:\workinformation\android\sdk\android-sdk-windows\platform-tools\adb.exe
ANT_HOME is set to D:\workspace\macaca\apache-ant-1.9.7

Installed driver list:

android: 1.1.15
chrome: 1.0.5

#137楼 @huangejuan 有没有尝试将macaca相关的都卸载了重新安装一次

#48楼 @adfghzhang 您好,个人的appleID 下的BundleID只有7天有效期,过期后又要重新打包才行,请问下有没有办法能解决?

Gavin Macaca-ios-java 真机踏平的那些坑 中提及了此贴 09 Jan 15:10

@adfghzhang 请问楼主,你有试过在 多台 iOS真机设备上并发执行测试用例过吗?是否了解 Macaca 有一个最大的并发数?我自己现在在 两台iOS真机设备上并行测试没什么问题,但是一旦添加一台设备以后,也就是 3 台设备同时测试的时候,总会出现一些莫名其妙的问题,而且也总是 有一台设备无法正常启动测试用例,而且还会 一直报 xctest client proxy error with: Error: socket hang up 这样的错误 ,请问楼主有碰到过这样的问题吗?

楼主,执行到检查环境的时候,找不到指令
这个怎么解决?谢谢。

重来看雨 macaca ios 真机 wda 配置踩的坑 中提及了此贴 18 Jan 14:04

#143楼 @tfzhou 你是用的npm i macaca-cli -g安装的么?

#71楼 @fengytn 你好 这个问题你是怎么解决的 我也遇见了 搞了一天了 还没研究出个结果

adfghzhang 回复

请问
点击了create什么都没有发生是什么鬼

adfghzhang 回复

你这个appleid,我随便注册一个可以么,还是一定要一个开发者的appleid?

adfghzhang #149 · March 09, 2017 作者
回复

随便一个appleid即可。。。

回复

那我点了什么都没发生/。/。。。

adfghzhang #151 · March 09, 2017 作者
回复

先添加账号,然后在新建证书

adfghzhang 回复

我就是先添加账号的,然后点create的,然后下面什么都没有生成

回复

先登录你的apple id 吧 你xcode里登录过apple id吗

小马 回复

登录了啊,这个账号就是登录好了,才能去create的

回复

自个儿 谷歌下呗 或者问下你们公司开发

小马 回复

问过开发了,昨晚折腾一晚上,点了create就是什么都没发生,也是醉了

回复

。。。。这种问题 那我也没遇到过 自己搜索下关键词 mac Development Singing Identities 之类的

adfghzhang #158 · March 10, 2017 作者
回复

create的过程比较慢,你耐心等待一会儿 或者 你用***试试。

adfghzhang 回复

没用,哎,搞得快疯掉了

adfghzhang 回复

是不是模拟器也要搞这个签名什么的,我还幻想模拟器不用,把他启动起来,我好先写脚本,看来是我想多了

是不是模拟器也要搞这个签名什么的,我还幻想模拟器不用,把他启动起来,我好先写脚本,看来是我想多了23333

adfghzhang 回复

我还是太年轻,心地太善良,性格太柔软2333

小马 回复

是不是模拟器也要搞这个签名什么的,我还幻想模拟器不用,把他启动起来,我好先写脚本,看来是我想多了233333

adfghzhang #164 · March 10, 2017 作者
回复

模拟器不用签名

adfghzhang 回复

😤 真是影响心情,最近我都失眠了

编译ios-app-bootstrap报import logger错误,没有这个模块

adfghzhang #167 · March 16, 2017 作者
Jackey 回复

在ios-app-boostrap根目录执行carthage update

adfghzhang 回复

这个包报找不到logger模块,怎么破

知道问题原因了,没有进入ios-app-bootstrap,执行carthage update下载依赖

要想真机测试,必须是使用要测试的APP的源码包么?我想做的项目,是在别人的APP应用里做的入口,想过把我们自己的应用的路径写死,然后打包,放在自动化的框架里,但是我们的应用里的业务,也有这个APP有接口上的交互,所以写死路径跑自动化的话,会有好多业务无法成功,这个怎么破?

adfghzhang #171 · March 17, 2017 作者
xin 回复

真机测试目前我测试过从appstore下载的包,直接用bundleId启动应用测试是没有问题的。

西瓜毛毛球 Macaca iOS 真机实战 中提及了此贴 23 Mar 15:57
恒温 Macaca iOS 真机实战 中提及了此贴 23 Mar 16:28
AllocAndInit 回复

请问楼主这个问题是怎么解决的呢?(error:Cannot find test framework "mocha" in )@AllocAndInit

小罗 回复

你先 cd 到 官方demo 的那个目录下,在那个目录下有一个 package.json 的文件,在当前目录下,你直接执行 npm install 就可以了

iOS checklist:
Xcode Command Line Tools require version: 2347 and above
提示这个,Xcode8.2.1,目前安装xcode-select version 2343.请问楼主这个问题怎么解决?

也遇到了楼上的问题,
Xcode Command Line Tools require version: 2347 and above
xcode已更新到8.3.3 , xcode-select -v 显示
xcode-select version 2345.1
去开发者平台下载安装了Command_Line_Tools_macOS_10.12_for_Xcode_8.3.dmg 还是不行,有人遇到这样的问题吗?

楼主你好,首先感谢你的分享,有两个问题请教,望回复:
1、ios真机测试需要被测app的项目源码吗?还是只打成debug的包就可以
2、你这个appium也是如此配置吗?

Macaca Ios 真机调试文档 https://testerhome.com/topics/12428

test报dyld: Library not loaded: @rpath/XCTest.framework/XCTest,谁遇到过啊

大浪 回复

个人的appleID 下的BundleID只有7天有效期,过期后又要重新打包才行,请问下有没有办法能解决?
请问这个有解了不

wei 回复

用企业开发者的

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up