配置文件内容已写:
# android专属配置 最后会和capability合并
androidCapability:
deviceName: "192.168.58.101:5555"
appPackage: "com.sinacp.ggaicai"
appActivity: "com.aicai.pluginhost.activity.MainActivity"
app: "/home/cmd/appcrawler/acp4.7p.apk"
appium: "http://127.0.0.1:4730/wd/hub"
macaca: "http://127.0.0.1:3456/wd/hub"
fullReset: false
noReset: true
automationName: macaca
reuse: 3
cmd@TR:~$ macaca server -p 3456 --verbose
>> index.js:18:12 [master] pid:16646 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2017-11-01 17:06:56' }
>> middlewares.js:17:10 [master] pid:16646 base middlewares attached
>> router.js:133:10 [master] pid:16646 router set
>> webdriver sdk launched
^[[A>> responseHandler.js:11:12 [master] pid:16646 Recieve HTTP Request from Client[2017-11-01 17:07:09]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"app":"","appPackage":"com.sinacp.ggaicai","reuse":3,"package":"com.sinacp.ggaicai","appium":"http://127.0.0.1:3456/wd/hub","noReset":true,"activity":"com.aicai.pluginhost.activity.MainActivity","deviceName":"192.168.58.101:5555","launchTimeout":120000,"fullReset":false,"appActivity":"com.aicai.pluginhost.activity.MainActivity","macaca":"http://127.0.0.1:3456/wd/hub","newCommandTimeout":120,"autoLaunch":"true","platformVersion":"","automationName":"macaca","autoWebview":"false","platformName":""}}
>> session.js:47:10 [master] pid:16646 Creating session, sessionId: b8ce1c6b-98e1-4f39-9c14-d76329e054af.
>> please run: `npm install macaca- -g`
>> session.js:40:14 [master] pid:16646 Error: Cannot find module 'macaca-'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:36:20)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
>> responseHandler.js:56:12 [master] pid:16646 Send Error Respone to Client: Error: >> session.js:40:14 [master] pid:16646 Error: Cannot find module 'macaca-'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:36:20)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
>> responseHandler.js:62:14 [master] pid:16646 Error: >> session.js:40:14 [master] pid:16646 Error: Cannot find module 'macaca-'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:36:20)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
at Logger.error (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/xlogger/lib/xlogger.js:169:9)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:40:14)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
at Object.toPromise (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:118:63)
at next (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:99:29)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:69:7)
Error: >> session.js:40:14 [master] pid:16646 Error: Cannot find module 'macaca-'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:36:20)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
at Logger.error (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/xlogger/lib/xlogger.js:169:9)
at detectDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:40:14)
at Object.createDevice (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:10:18)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Object.co (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
at Object.toPromise (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:118:63)
at next (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:99:29)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:69:7)
cmd@TR:~/appcrawler$ java -jar appcrawler-2.1.2.jar -c conf/acp.yml -u http://127.0.0.1:3456/wd/hub -o result/
2017-11-01 17:07:06 INFO [DataRecord.append.13] append 1
2017-11-01 17:07:06 INFO [AppCrawler$.main.86]
----------------
AppCrawler 2.1.2 [霍格沃兹测试学院特别纪念版]
Appium Version 1.7.1 support
app爬虫, 用于自动遍历测试. 支持Android和iOS, 支持真机和模拟器
帮助文档: https://github.com/seveniruby/AppCrawler
移动测试技术交流: https://testerhome.com
感谢: 晓光 泉龙 杨榕 恒温 mikezhou yaming116 沐木
感谢如下公司提供商业支持: Keep
--------------------------------
2017-11-01 17:07:06 INFO [AppCrawler$.parseParams.199] Find Conf /home/cmd/appcrawler/conf/acp.yml
2017-11-01 17:07:07 WARN [AppCrawler$.parseParams.216] can not know what platform, will use default android, please use -p to set the platform
2017-11-01 17:07:07 INFO [AppCrawler$.parseParams.218] Set Platform=android
2017-11-01 17:07:07 INFO [AppCrawler$.parsePath.335] use app in the config file
2017-11-01 17:07:07 INFO [AppCrawler$.parseParams.233] app path =
2017-11-01 17:07:07 INFO [AppCrawler$.parseParams.251] appium address = Some(http://127.0.0.1:3456/wd/hub)
2017-11-01 17:07:07 INFO [AppCrawler$.parseParams.263] result directory = result/
2017-11-01 17:07:07 INFO [DataRecord.initLog.30] alread exist
2017-11-01 17:07:07 INFO [DataRecord.append.13] append 1
2017-11-01 17:07:07 INFO [Crawler.loadPlugins.82] dynamic load plugin in /home/cmd/appcrawler/plugins/
2017-11-01 17:07:08 INFO [Runtimes$.loadPlugins.88] find plugins in /home/cmd/appcrawler/plugins/
2017-11-01 17:07:08 INFO [Runtimes$.loadPlugins.89] List()
2017-11-01 17:07:08 INFO [Runtimes$.loadPlugins.90] List()
2017-11-01 17:07:09 INFO [Crawler.loadPlugins.84] found dynamic plugins size 0
2017-11-01 17:07:09 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.TagLimitPlugin@5c53f292
2017-11-01 17:07:09 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.ReportPlugin@270a620
2017-11-01 17:07:09 INFO [Crawler.$anonfun$loadPlugins$5.86] com.testerhome.appcrawler.plugin.FreeMind@5ff00507
2017-11-01 17:07:09 INFO [TagLimitPlugin.init.17] com.testerhome.appcrawler.plugin.TagLimitPlugin init
2017-11-01 17:07:09 INFO [ReportPlugin.init.17] com.testerhome.appcrawler.plugin.ReportPlugin init
2017-11-01 17:07:09 INFO [FreeMind.init.17] com.testerhome.appcrawler.plugin.FreeMind init
2017-11-01 17:07:09 INFO [ReportPlugin.start.21] reportPath=/home/cmd/appcrawler/result
2017-11-01 17:07:09 INFO [Crawler.start.127] prepare setup Appium
2017-11-01 17:07:09 INFO [Crawler.setupAppium.253] use macaca
{"desiredCapabilities":{"app":"","appPackage":"com.sinacp.ggaicai","reuse":3,"package":"com.sinacp.ggaicai","appium":"http://127.0.0.1:3456/wd/hub","noReset":true,"activity":"com.aicai.pluginhost.activity.MainActivity","deviceName":"192.168.58.101:5555","launchTimeout":120000,"fullReset":false,"appActivity":"com.aicai.pluginhost.activity.MainActivity","macaca":"http://127.0.0.1:3456/wd/hub","newCommandTimeout":120,"autoLaunch":"true","platformVersion":"","automationName":"macaca","autoWebview":"false","platformName":""}}2017-11-01 17:07:09 Request:http://localhost:3456/wd/hub/session:{"desiredCapabilities":{"app":"","appPackage":"com.sinacp.ggaicai","reuse":3,"package":"com.sinacp.ggaicai","appium":"http://127.0.0.1:3456/wd/hub","noReset":true,"activity":"com.aicai.pluginhost.activity.MainActivity","deviceName":"192.168.58.101:5555","launchTimeout":120000,"fullReset":false,"appActivity":"com.aicai.pluginhost.activity.MainActivity","macaca":"http://127.0.0.1:3456/wd/hub","newCommandTimeout":120,"autoLaunch":"true","platformVersion":"","automationName":"macaca","autoWebview":"false","platformName":""}}
2017-11-01 17:07:09 Response:Internal Server Error
Exception in thread "main" com.alibaba.fastjson.JSONException: syntax error, pos 1, json : Internal Server Error
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:117)
at macaca.client.common.Utils.request(Utils.java:157)
at macaca.client.commands.Session.createSession(Session.java:35)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:1189)
at com.testerhome.appcrawler.driver.MacacaDriver.appium(MacacaDriver.scala:132)
at com.testerhome.appcrawler.driver.MacacaDriver.<init>(MacacaDriver.scala:34)
at com.testerhome.appcrawler.Crawler.setupAppium(Crawler.scala:254)
at com.testerhome.appcrawler.Crawler.start(Crawler.scala:128)
at com.testerhome.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:343)
at com.testerhome.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:311)
at com.testerhome.appcrawler.AppCrawler$.main(AppCrawler.scala:91)
at com.testerhome.appcrawler.AppCrawler.main(AppCrawler.scala)
看 macaca server 端日志的意思 是没找到 macaca 模块 实际我的 macaca 是好的。