Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
葫芦Android失败,未找到任何网络视图_Android_Automation_Robotium_Calabash - Fatal编程技术网

葫芦Android失败,未找到任何网络视图

葫芦Android失败,未找到任何网络视图,android,automation,robotium,calabash,Android,Automation,Robotium,Calabash,在我们的每项活动中,我们都有一个带有嵌入式网络视图的装置。 在某个页面上,我们显示一个进度条,然后显示Webview,再次显示进度条,最后加载内容 最后,我们使用query方法触发一个Javascript查询。我们的固定装置最终看起来像这样- performAction('wait_for_no_progress_bars') performAction("wait_for_view_by_id", 'webView') performAction('wait_for_no_progress_b

在我们的每项活动中,我们都有一个带有嵌入式网络视图的装置。 在某个页面上,我们显示一个进度条,然后显示Webview,再次显示进度条,最后加载内容

最后,我们使用query方法触发一个Javascript查询。我们的固定装置最终看起来像这样-

performAction('wait_for_no_progress_bars')
performAction("wait_for_view_by_id", 'webView')
performAction('wait_for_no_progress_bars')
performAction("wait_for_view_by_id", 'webView')
result =query("webView, css:"+locator)
它在查询步骤中失败,说“找不到Web视图”。在此之前的步骤通过(它获取WebView),但查询步骤失败。 你知道会出什么问题吗

在研究robotium源代码时,我们发现查询方法在内部使用“
getCurrentViews()
”,它不仅查看可见性,还对高度进行一些处理。我们在这里的视野相当高。这会引起什么问题吗

控制台输出如下:

2013-01-10 14:33:42 - Action: wait_for_no_progress_bars - Params: 
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_view_by_id - Params: webView
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_no_progress_bars - Params:
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_view_by_id - Params: webView
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:47 - Action: query - Params: css, #payment_info
2013-01-10 14:33:48 - Result:'{"bonusInformation":["Exception stack trace:\njava.lang.RuntimeException: No webviews found\n\tat sh.calaba.instrumentationbackend.actions.webview.QueryHelper.executeJavascriptInWebview(QueryHelper.java:35)\n\tat sh.calaba.instrumentationbackend.actions.webview.Query.execute(Query.java:13)\n\tat sh.calaba.instrumentationbackend.Command.execute(Command.java:49)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:158)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:114)\n\tat sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:412)\n\tat java.lang.Thread.run(Thread.java:856)\n"],"message":"No webviews found","success":false}'
Activity to be started :class com.abcd.mobile.android.booking.PaymentInfoActivity
I/ActivityManager(   79): START {cmp=com.abcd.mobile.android/.booking.PaymentInfoActivity} from pid 2041
W/WindowManager(   79): Failure taking screenshot for (180x300) to layer 21045
W/InputManagerService(   79): Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4169adf0 (uid=10045 pid=2041)
D/RhinoConnector( 2041): Instantiating connection for activity com.abcd.mobile.android.booking.PaymentInfoActivity
D/dalvikvm( 2041): GC_CONCURRENT freed 1892K, 13% free 27424K/31175K, paused 7ms+24ms
I/Process (   79): Sending signal. PID: 2041 SIG: 3
I/dalvikvm( 2041): threadid=3: reacting to signal 3abcd
D/RhinoConnector( 2041): Rhino bounded. Executing post connection hook for com.abcd.mobile.android.booking.PaymentInfoActivity
I/dalvikvm( 2041): Wrote stack traces to '/data/anr/traces.txt'
V/PhoneStatusBar(  152): setLightsOn(true)
I/Process (   79): Sending signal. PID: 2041 SIG: 3
I/dalvikvm( 2041): threadid=3: reacting to signal 3
I/System.out( 2041): URI: /
I/System.out( 2041): header: {content-type=application/json;charset=utf-8, connection=close, user-agent=Ruby, host=127.0.0.1:34777, content-length=55, accept=*/*}
I/System.out( 2041): params: {json={"command":"query","arguments":["css","#payment_info"]}
I/System.out( 2041): }
I/System.out( 2041): files: {}
I/System.out( 2041): command: {"command":"query","arguments":["css","#payment_info"]}
I/InstrumentationBackend( 2041): Got command:'Command:'Line:null,query', arguments:'[css, #payment_info]'
I/dalvikvm( 2041): Wrote stack traces to '/data/anr/traces.txt'
W/System.err( 2041): java.lang.RuntimeException: No webviews found
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.webview.QueryHelper.executeJavascriptInWebview(QueryHelper.java:35)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.webview.Query.execute(Query.java:13)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.Command.execute(Command.java:49)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:158)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:114)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:412)
W/System.err( 2041):    at java.lang.Thread.run(Thread.java:856)
ADB日志如下所示:

2013-01-10 14:33:42 - Action: wait_for_no_progress_bars - Params: 
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_view_by_id - Params: webView
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_no_progress_bars - Params:
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:42 - Action: wait_for_view_by_id - Params: webView
2013-01-10 14:33:42 - Result:'{"bonusInformation":[],"message":"","success":true}'
2013-01-10 14:33:47 - Action: query - Params: css, #payment_info
2013-01-10 14:33:48 - Result:'{"bonusInformation":["Exception stack trace:\njava.lang.RuntimeException: No webviews found\n\tat sh.calaba.instrumentationbackend.actions.webview.QueryHelper.executeJavascriptInWebview(QueryHelper.java:35)\n\tat sh.calaba.instrumentationbackend.actions.webview.Query.execute(Query.java:13)\n\tat sh.calaba.instrumentationbackend.Command.execute(Command.java:49)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:158)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:114)\n\tat sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:412)\n\tat java.lang.Thread.run(Thread.java:856)\n"],"message":"No webviews found","success":false}'
Activity to be started :class com.abcd.mobile.android.booking.PaymentInfoActivity
I/ActivityManager(   79): START {cmp=com.abcd.mobile.android/.booking.PaymentInfoActivity} from pid 2041
W/WindowManager(   79): Failure taking screenshot for (180x300) to layer 21045
W/InputManagerService(   79): Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4169adf0 (uid=10045 pid=2041)
D/RhinoConnector( 2041): Instantiating connection for activity com.abcd.mobile.android.booking.PaymentInfoActivity
D/dalvikvm( 2041): GC_CONCURRENT freed 1892K, 13% free 27424K/31175K, paused 7ms+24ms
I/Process (   79): Sending signal. PID: 2041 SIG: 3
I/dalvikvm( 2041): threadid=3: reacting to signal 3abcd
D/RhinoConnector( 2041): Rhino bounded. Executing post connection hook for com.abcd.mobile.android.booking.PaymentInfoActivity
I/dalvikvm( 2041): Wrote stack traces to '/data/anr/traces.txt'
V/PhoneStatusBar(  152): setLightsOn(true)
I/Process (   79): Sending signal. PID: 2041 SIG: 3
I/dalvikvm( 2041): threadid=3: reacting to signal 3
I/System.out( 2041): URI: /
I/System.out( 2041): header: {content-type=application/json;charset=utf-8, connection=close, user-agent=Ruby, host=127.0.0.1:34777, content-length=55, accept=*/*}
I/System.out( 2041): params: {json={"command":"query","arguments":["css","#payment_info"]}
I/System.out( 2041): }
I/System.out( 2041): files: {}
I/System.out( 2041): command: {"command":"query","arguments":["css","#payment_info"]}
I/InstrumentationBackend( 2041): Got command:'Command:'Line:null,query', arguments:'[css, #payment_info]'
I/dalvikvm( 2041): Wrote stack traces to '/data/anr/traces.txt'
W/System.err( 2041): java.lang.RuntimeException: No webviews found
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.webview.QueryHelper.executeJavascriptInWebview(QueryHelper.java:35)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.webview.Query.execute(Query.java:13)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.Command.execute(Command.java:49)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:158)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:114)
W/System.err( 2041):    at sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:412)
W/System.err( 2041):    at java.lang.Thread.run(Thread.java:856)
试一试

而不是

performAction("wait_for_view_by_id", 'webView')