请问各位大神,在使用 macaca 编写测试脚本中,如何获取 element 对应的 ID 是多少呢?(我现在使用的是 uiautomatorviewer 去获取,但是经常获取到的 ID 有误,或某些元素根本没有 ID;然后只能获取当前页面所有 ID 一个个的尝试 -- 此方法太 low 了)
@tsj1107 有点看不明白,请指导下。
第一,demo 脚本中 .native() .webview() 这些方法,在 api.md 中没有搜到。
第二,在 api.md 中找到 status(),在 demo 脚本中增加 .status(),运行成功,却不能获取到 server's 的状态
@jessiezhou0412 我也是小白, 按照各位大神给的步骤,一步步操作。最后才成功运行了 demo。 在折腾的过程中我个人觉得,主要是环境依赖上出现较多问题。 如 node.js npm 的版本, macaca-webdriver 和 macaca-android 未成功安装。
@tsj1107 是的,我是先启动了 一个 virtual device(使用 ./emulator @Nexus_5_API_22
emulator: UpdateCheck: current version '24.4.1', last version '24.4.1'); 但在执行 macaca run 时,出现以下问题:
install macaca-android failed with Error: Cannot find module 'macaca-android'
responseHandler.js:56:12 [master] pid:7847 Send Error Respone to Client TypeError: Android is not a function
@tsj1107 按你的步骤,执行 macaca run --server,显示:webdriver sdk launched。
请问后续如何操作(完全小白)?
执行出现如下错误:
\ loading...
install macaca-android success
install macaca-android failed with Error: Cannot find module 'macaca-android'
responseHandler.js:56:12 [master] pid:14028 Send Error Respone to Client TypeError: Android is not a function
responseHandler.js:62:14 [master] pid:14028 TypeError: Android is not a function
at WebdriverServer.detectDevice (/usr/local/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/server/index.js:54:14)
at WebdriverServer.start (/usr/local/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/server/index.js:38:22)
at next (native)
at onFulfilled (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:65:19)
at /usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:54:5
at Object.co (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:50:10)
at Object.toPromise (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:118:63)
at next (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:99:29)
at onFulfilled (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:69:7)
at /usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:54:5
responseHandler.js:81:14 [master] pid:14028 Unexcepted error TypeError
InternalServerError: Internal Server Error
at Object.module.exports.throw (/usr/local/lib/node_modules/macaca-client/node_modules/webdriver-server/node_modules/koa/lib/context.js:91:23)
at Object.module.exports (/usr/local/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/server/responseHandler.js:82:17)
at throw (native)
at onRejected (/usr/local/lib/node_modules/macaca-client/node_modules/co/index.js:81:24)
at process._tickCallback (node.js:365:9)
responseHandler.js:24:12 [master] pid:14028 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
responseHandler.js:48:14 [master] pid:14028 Send HTTP Respone to Client: {"sessionId":"","status":0}
麻烦讲解下 package.json 是干什么的呢, 其中的内容 是什么含义,例如:
"dependencies": {
"macaca-chromedriver": "",
"wd": ""
},
@xdf 你好,在环境搭建好后,执行 make test-android,出现以下错误,请帮忙指导下:
middlewares.js:31:10 [master] pid:9507 base middlewares attached
router.js:101:10 [master] pid:9507 router set
webdriver sdk launched
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn /usr/local/lib/node_modules/.macaca-client_npminstall/mocha/2.2.4/.bin/mocha ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:438:9)
at process._tickCallback (node.js:352:17)
@xdf 麻烦给一个 android 的示例嘛,没明白脚本中是如何调用模拟器的。