Macaca Macaca iOS 真机测试

adfghzhang · 2016年08月28日 · 最后由 大浪 回复于 2019年03月15日 · 6427 次阅读
本帖已被设为精华帖!

为了弄这个真机的测试,一个周末就过去了,特别对不起我孩子,本来一周就只有一天能陪他了,还被我占用了。当成功打开被测 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 条回复 时间 点赞

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

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

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

用企业开发者的

回复

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

点赞,希望帮助到更多人

匿名 #3 · 2016年08月28日

必须赞,必须顶

恒温 将本帖设为了精华贴 08月28日 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

Coyinper [該主題已被刪除] 中提及了此贴 09月18日 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

#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

#58 楼 @praguepp 换 cnpm 吧

问题已解决,感谢 CoderToSurvive

@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 版本和驱动

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

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

老马 [該主題已被刪除] 中提及了此贴 10月28日 15:30
马尾 [該主題已被刪除] 中提及了此贴 11月11日 16:56
chengliang lei [該主題已被刪除] 中提及了此贴 11月11日 17:21

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

匿名 #82 · 2016年11月14日

#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 吗,这样是不是太浪费时间了,有什么办法可以解决

楼主大神,请教个问题啊:按照您帖子里面步骤,到给手机安装 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 总结记 中提及了此贴 11月29日 14:46

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

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

[求助] 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

@longmmh 升级,看中文文档

#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

@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 的代码贴出来吗?不知道你用的是什么框架,

志雄 [該主題已被刪除] 中提及了此贴 12月06日 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 还是报相同的错,这是什么情况?

#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$

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

#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 **
请问这个该如何解决

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

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

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 后报错,请问怎么破?

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:
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

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

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

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

@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

@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 相关的都卸载了重新安装一次

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

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

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

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

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

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

adfghzhang 回复

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

回复

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

adfghzhang 回复

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

adfghzhang 回复

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

回复

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

回复

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

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

回复

随便一个 appleid 即可。。。

老马 回复

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

回复

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

老马 回复

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

回复

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

adfghzhang 回复

没用,哎,搞得快疯掉了

adfghzhang 回复

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

adfghzhang 回复

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

老马 回复

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

回复

模拟器不用签名

adfghzhang 回复

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

Jackey 回复

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

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

adfghzhang 回复

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

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

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

xin 回复

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

zujie Macaca iOS 真机实战 中提及了此贴 03月23日 15:57
恒温 Macaca iOS 真机实战 中提及了此贴 03月23日 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 还是不行,有人遇到这样的问题吗?

42楼 已删除

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

75楼 已删除
Coyinper python ios 真机测试 中提及了此贴 11月22日 00:05
匿名 #179 · 2019年02月11日
大浪 回复

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

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

@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'

需要 登录 後方可回應,如果你還沒有帳號按這裡 注册