补充:直接在 REPL 中执行也是报错,确定是回复中说的 devtool 问题?
> const wd = require('wd');
TypeError: Identifier 'wd' has already been declared
at repl:1:1
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:431:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
at REPLServer.Interface._line (readline.js:550:8)
at REPLServer.Interface._ttyWrite (readline.js:827:14)
MAC 安装完毕 devtool 后,启动 devtool,
cd macaca-ios-test-sample
devtool
然后界面中输入第一行指令就出错,devtool 中指令:
const wd = require('wd');
报错内容为:
module.js:442 Uncaught Error: Cannot find module 'wd'(…)
还请问下是什么原因?我看截图是 top frame,装好后只能选 top,不知道是否和这个有关
在安装完 macaca android 版本并成功运行用例的情况下,使用指令'npm i app-inspector -g'安装报错,提示如下。设备为 win 10 32 位:
C:\Users\client>npm i app-inspector -g
npm WARN deprecated win-spawn@2.0.0: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
> webdriveragent@1.0.16 install C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\webdriveragent
> unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null
|系统找不到指定的路径。
> uiautomator-client@1.0.16 install C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client
> node ./scripts/build.js
JAVA_HOME is set to D:\Program Files\Java\jdk1.8.0_72
Updated
file C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\build.xml
Buildfile: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 25.1.7
[checkenv] Installed at D:\SoftWare\Develop\Android\SDK-build-setup:
[getbuildtools] Using latest Build Tools: 24.0.1
[echo] Resolving Build Target for uiautomator-bootstrap...
[getuitarget] Project Target: Android 6.0
[getuitarget] API level: 23
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin
[mkdir] Created dir: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes-pre-compile:compile:
[javac] Compiling 18 source files to C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
[javac] ����: [options] Դֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ��
[javac] ����: [options] Ŀ��ֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ�� [javac] ����: [options] Ҫ�����й��ѹ�ʱѡ���ľ���, ��ʹ�� -Xlint:-options��
[javac] 3 �����
�
-post-compile:
-dex:
[dex] input: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
[dex] Converting compiled files and external libraries into C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes.dex...
-post-dex:
-jar:
[jar] Building jar: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\uiautomator-bootstrap.jar
-post-jar:
build:
BUILD SUCCESSFULTotal time: 6 seconds
uiautomator-bootstrap build success!
npm WARN optional dep failed, continuing fsevents@1.0.14
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "app-inspector" "-g"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! webdriveragent@1.0.16 install: `unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webdriveragent@1.0.16 install script 'unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null'.
npm ERR! This is most likely a problem with the webdriveragent package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webdriveragent
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls webdriveragent
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\client\npm-debug.log
大神,fir.im 又无法登陆了,直接报 Internal Server Error,请尽快修复。
必须支持,313077271 期待中
大侠,东西很棒!但有个问题,长时间运行后,整个 mac 都变得好卡,这块能否在最新的版本中解决下?
#123 楼 @vigossjjj 首先感谢楼主的工作!对于参数-t 不是太明白,试了几次,当不指定-t 时,每次执行,从开始到结束一般也就 40s,指定-t 500,发现也是 40s 左右旧结束了,请指点
你那个控件是不是 image 或 text?click 一般对 button、tabcell 等类型有效,并不是所有控件都能用 click
请问根据坐标拖动成功了没?
我也遇到这个问题,就算 Xpath 不变,在同一个测试用例中,第一次使用 xpath 能正确找到控件,但如果对其他控件再次使用 xpath 就有问题,报找不到该控件,感觉有个什么缓存机制,如果确实有,有什么办法可以在每次使用 xpath 前清空缓存的吗?求教
#7 楼 @mouseyoung 打开了。我怀疑是打包的问题,请问打包需要什么特别的要求吗?使用的是开发者证书打的包,本机的 UDID 也加到了 provision 文件中。
#6 楼 @lihuazhang 真机端将 Enable UI Automation 打开了,还需要其他什么设置?
以上是配置截图
真机运行起 appium 足矣,哈哈哈哈
#3 楼 @lihuazhang 首先承认错误,后续发帖务必先看清要求。然后是问题,使用开发者证书打的包可以在真机运行,appium GUI 也能拉起应用(只是提示 ail: Could not start script, target application is not frontmost.),是不是能证明本身打包和证书是没问题的,也看了你的真机运行的文章,目前还不能确定问题可能出在哪边,还望能指正,是证书问题?appium 配置问题?版本匹配问题?多谢!