【已解决】Android真机执行脚本,webview无法执行
问题: android 真机中运行test.js 当有.webview() 时候回卡主,最后抛错如下面log信息 eg: it('#4 should go into webview', function() { return driver .sleep(5000) .webview() .elementById('pushView') .click() .sleep(5000) .webview() .elementById('popView') .click() .sleep(5000) .takeScreenshot(); });
错误信息:
- macaca test sample #4 should go into webview:
Error: [contexts()] Not JSON response
at exports.newError (node_modules/macaca-wd/wd/lib/utils.js:139:13)
at node_modules/macaca-wd/wd/lib/callbacks.js:59:17
at node_modules/macaca-wd/wd/lib/webdriver.js:179:5
at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
at Request.
(node_modules/macaca-wd/node_modules/request/request.js:1219:14) at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12) at endReadableNT (_stream_readable.js:921:12)
mac host:
Host Database
localhost is used to configure the loopback interface
when the system is booting. Do not change this entry.
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
-
Macaca Version: 1.0.35
-
Macaca Doctor: Node.js checklist:
node env: /usr/local/bin/node node version: v4.4.7
iOS checklist:
Xcode is installed at:
/Applications/Xcode.app/Contents/DeveloperXcode Command Line Tools is ready, version: 2343. ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxyAndroid checklist:
JAVA version is
1.8.0_11JAVA_HOME is set to/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/HomeANDROID_HOME is set to/Users/lemon/work/sdk/android-sdk-macosxPlatforms is set to/Users/lemon/work/sdk/android-sdk-macosx/platforms/android-23Android tools is set to/Users/lemon/work/sdk/android-sdk-macosx/tools/androidInstalled driver list:
android: 1.0.13 ios: 1.0.30
-
Platform: android
@xudafeng ios 模拟器ok ,ios 真机没有测试 测试程序无法安装到真机上,没有去看具体为什么。(无法从 .zip文件安装到->真机上),感觉是证书上的问题。 本地程序可以。 android模拟器没有测试。android测试一般也不会用模拟器...太慢。 android机器 小米5 6.0 系统 android机器 nexus5 6.0系统 三星note4 5.0系统
@lemonadam x86模拟器速度还可以。
webview问题多半出在chromedriver连接不正常,chrome://inspect/#devices 看下
@xudafeng 测试了x86 android模拟器。 是可以的。 android真机不行。
@lemonadam N5 试试?
@xudafeng N5 是什么机器? Nexus 5 么,我试过了 android机器 小米5 6.0 系统 android机器 nexus5 6.0系统 三星note4 5.0系统 以上机器均不行。 就是报告:
- macaca test sample #4 should go into webview: Error: [contexts()] Not JSON response
@lemonadam 除非关闭或者阉割 webkit remote debug的手机不可以,大部分厂商的都可以
@lemonadam 演示中的手机是 MX2 https://testerhome.com/topics/4541