最近公司打算引入 app 的自动化,本菜鸡也在尝试 appium 和 Macaca 这两者的异同,appium 是我之前就用的,所以在换了 Xcode7 之后就简单写了 Android 和 iOS 的简单脚本。在用 Macaca 的时候遇到点问题,我已经很久没有更新 Macaca 了,第一次是在 9 月初安装使用,当时使用起来一点问题也没有,但是在 iOS10 推出后,我发现 app-inspector 无法启动了,输入命令之后一直提示:
打开--verbose 之后看到的是:
后来搜帖子说是要改 wda 的 bundle id 但是改来改去一直没好,直到刚才群里有人帮我远程修改了下,才顺利解决问题。我大致图文介绍下操作:
1、先执行 macaca doctor 检查下依赖和驱动,执行 cnpm i app-inspector -g 更新下最新的 inspector
注:如果提示 cnpm 不可用,可以先执行 npm install -g cnpm --registry=https://registry.npm.taobao.org 下载。
2、在 inspector 更新后可以看到应该是 1.2.14 版本了
3、这一步就是上文提及的修改 wda 了,在你执行 app-inspector -u xxx --verbose 报错输出里可以看到这个:
然后可以复制下前面的 path 用这个方式打开:
WebDriverAgent.xcodeproj 打开后修改这两个地方
WebDriverAgentLib 和 WebDriverAgentRunner 把他们 team 那里的"none"改为自己的 Apple 账号(自己注册的就行,不用那种付费的开发者账号),然后把 bundle id 修改下,比如
最简单的就是把原来的 bundle id 里的 facebook 换成你的姓氏名字的拼音。否则可能会提示这个错误:
把 team 和 bundle id 修改后退出 xcode,再重新启动下 app-inspector 下发现没有报错了:
然后久违的页面也出来了:
以上,希望能帮助到大家!
感谢分享,先收藏
真棒,赞你~
照着改还是不行,把原来的 bundle id 里的 facebook 换成你的姓氏名字的拼音后还是提示无法创建描述文件,普通用户能创建那描述文件吗?
新手 纠结 APPium 问题中
我的 inspector 可以真机启动,但是我的真机测试不行, 帮我看下呗
Running macaca.client.IosSampleTest
404
Response content:Not Found
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.076 sec <<< FAILURE!
test_case_1(macaca.client.IosSampleTest) Time elapsed: 0.613 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.614 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: 3.284 s
[INFO] Finished at: 2016-12-09T15:17:59+08:00
[INFO] Final Memory: 16M/211M
[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
楼主请问我的这样 问题是出现在哪里, bundle id 和 team 是按照你说的那样改的