macaca icon indicating copy to clipboard operation
macaca copied to clipboard

【已解决】Android真机执行脚本,webview无法执行

Open lemonadam opened this issue 10 years ago • 8 comments

问题: 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(); });

错误信息:

  1. 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/Developer Xcode Command Line Tools is ready, version: 2343. ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

    Android checklist:

    JAVA version is 1.8.0_11 JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home ANDROID_HOME is set to /Users/lemon/work/sdk/android-sdk-macosx Platforms is set to /Users/lemon/work/sdk/android-sdk-macosx/platforms/android-23 Android tools is set to /Users/lemon/work/sdk/android-sdk-macosx/tools/android

    Installed driver list:

    android: 1.0.13 ios: 1.0.30

  • Platform: android

lemonadam avatar Jul 07 '16 12:07 lemonadam

@xudafeng ios 模拟器ok ,ios 真机没有测试 测试程序无法安装到真机上,没有去看具体为什么。(无法从 .zip文件安装到->真机上),感觉是证书上的问题。 本地程序可以。 android模拟器没有测试。android测试一般也不会用模拟器...太慢。 android机器 小米5 6.0 系统 android机器 nexus5 6.0系统 三星note4 5.0系统

lemonadam avatar Jul 07 '16 12:07 lemonadam

@lemonadam x86模拟器速度还可以。

webview问题多半出在chromedriver连接不正常,chrome://inspect/#devices 看下

xudafeng avatar Jul 07 '16 13:07 xudafeng

@xudafeng 测试了x86 android模拟器。 是可以的。 android真机不行。

lemonadam avatar Jul 08 '16 08:07 lemonadam

@lemonadam N5 试试?

xudafeng avatar Jul 08 '16 09:07 xudafeng

@xudafeng N5 是什么机器? Nexus 5 么,我试过了 android机器 小米5 6.0 系统 android机器 nexus5 6.0系统 三星note4 5.0系统 以上机器均不行。 就是报告:

  1. macaca test sample #4 should go into webview: Error: [contexts()] Not JSON response

lemonadam avatar Jul 08 '16 09:07 lemonadam

@lemonadam 除非关闭或者阉割 webkit remote debug的手机不可以,大部分厂商的都可以

xudafeng avatar Jul 08 '16 10:07 xudafeng

@lemonadam 演示中的手机是 MX2 https://testerhome.com/topics/4541

xudafeng avatar Jul 12 '16 05:07 xudafeng

@lemonadam

查看演示

Android 6.0.1

Nexus 5

xudafeng avatar Jul 14 '16 03:07 xudafeng