RuntimeError: Querying WebView

299 views
Skip to first unread message

dav...@datacom.co.nz

unread,
Jun 7, 2015, 11:00:35 PM6/7/15
to calabash...@googlegroups.com
Hi,

I was successfully querying and interacting with webView elements up until yesterday using the query format

query("webView css:'*' ")
touch("webView css:'*' ")

I have not changed anything in my application but today, when I tried the same commands, I get the error:

RuntimeError: map webView css:'*', query failed because: java.util.concurrent.ExecutionException: java.lang.RuntimeException: sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.HashMap out of START_ARRAY token
 at [Source: java.io.StringReader@27ee7684; line: 1, column: 1]

Does anyone have any idea why this might be?
I can't think of any changes I have made to my dev environment between the last time the commands worked and now.

I did update my calabash gem versions using bundler (0.5.10) so I tried reverting to an older version (0.5.9) with no luck.

Thanks in advance

tobias....@xamarin.com

unread,
Jun 8, 2015, 6:09:35 AM6/8/15
to calabash...@googlegroups.com, dav...@datacom.co.nz
Are you using Android m? 

Sathish Gogineni

unread,
Jun 9, 2015, 9:44:22 AM6/9/15
to calabash...@googlegroups.com, dav...@datacom.co.nz
Hi,

I am seeing the same error. this is happening only in Moto G after I upgrade to Android 5.0.2 version.

RuntimeError: map webView css:'*', query failed because: java.util.concurrent.ExecutionException: java.lang.RuntimeException: sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.HashMap out of START_ARRAY token
 at [Source: java.io.StringReader@3c5095b7; line: 1, column: 1]

the adb logs has the following warning

W/System.err(14472): Caused by: java.lang.RuntimeException: sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.HashMap out of START_ARRAY token
W/System.err(14472):  at [Source: java.io.StringReader@3c5095b7; line: 1, column: 1]
W/System.err(14472):    at sh.calaba.instrumentationbackend.query.ast.UIQueryUtils$MapWebContainer.call(UIQueryUtils.java:337)
W/System.err(14472):    at sh.calaba.instrumentationbackend.query.ast.UIQueryUtils$MapWebContainer.call(UIQueryUtils.java:290)
W/System.err(14472):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err(14472):    at android.os.Handler.handleCallback(Handler.java:739)
W/System.err(14472):    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err(14472):    at android.os.Looper.loop(Looper.java:135)
W/System.err(14472):    at android.app.ActivityThread.main(ActivityThread.java:5312)
W/System.err(14472):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(14472):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(14472):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
W/System.err(14472):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
W/System.err(14472): Caused by: sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.HashMap out of START_ARRAY token
W/System.err(14472):  at [Source: java.io.StringReader@3c5095b7; line: 1, column: 1]
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212)
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:246)
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:33)
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2765)
W/System.err(14472):    at sh.calaba.org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1903)
W/System.err(14472):    at sh.calaba.instrumentationbackend.query.ast.UIQueryUtils$MapWebContainer.call(UIQueryUtils.java:326)
W/System.err(14472):    ... 10 more

tobias....@xamarin.com

unread,
Jun 9, 2015, 9:52:34 AM6/9/15
to calabash...@googlegroups.com, sathish....@gmail.com, dav...@datacom.co.nz
There should be a bit more information in the adb logcat, telling us which string it failed to parse. 

Would it be possible for you to send me an apk for which this occurs?

Sathish Gogineni

unread,
Jun 9, 2015, 10:31:21 AM6/9/15
to calabash...@googlegroups.com, dav...@datacom.co.nz, sathish....@gmail.com
Yes,

I was looking into code and dig into further. the error is misguiding as it is part of Exception handling. So i remove the code written in Exception Handler and throwing original exception.  the original error is 

W/System.err(12379): Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'float java.lang.Number.floatValue()' on a null object reference
W/System.err(12379):    at sh.calaba.instrumentationbackend.query.WebContainer.translateRectToScreenCoordinates(WebContainer.java:221)
W/System.err(12379):    at sh.calaba.instrumentationbackend.query.ast.UIQueryUtils$MapWebContainer.call(UIQueryUtils.java:309)
W/System.err(12379):    at sh.calaba.instrumentationbackend.query.ast.UIQueryUtils$MapWebContainer.call(UIQueryUtils.java:290)
W/System.err(12379):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err(12379):    at android.os.Handler.handleCallback(Handler.java:739)
W/System.err(12379):    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err(12379):    at android.os.Looper.loop(Looper.java:135)

Basically, the JSON has only center_x and center_y and doesn't have left and top values. Here is the Json response

[{"rect":{"center_x":165,"center_y":278},"nodeType":"ELEMENT_NODE","nodeName":"BUTTON","id":"u_0_1","class":"_54k8 _56bs _56b_ _56bw _56bu","html":"<button type=\"submit\" value=\"Log In\" class=\"_54k8 _56bs _56b_ _56bw _56bu\" name=\"login\" id=\"u_0_1\" data-sigil=\"touchable\"><span class=\"_55sr\">Log In</span></button>","textContent":"Log In"}]

Regards,
Sathish

tobias....@xamarin.com

unread,
Jun 9, 2015, 11:07:53 AM6/9/15
to calabash...@googlegroups.com, sathish....@gmail.com, dav...@datacom.co.nz
Are you running a custom distribution of Calabash-Android? What is your Calabash-Android version?

Sathish Gogineni

unread,
Jun 9, 2015, 11:17:12 AM6/9/15
to calabash...@googlegroups.com, sathish....@gmail.com, dav...@datacom.co.nz
No, i have 0.5.10 

I change the framework code to check the original error. this is happening only in Moto G phones with 5.0.2

Regards,
Sathish

Youp Hulsebos

unread,
Jun 10, 2015, 3:12:11 AM6/10/15
to calabash...@googlegroups.com, sathish....@gmail.com
I just ran into this issue. When I saw it I noticed the Webview for Android app had been updated. Removing the update removes the problem. So we are using that as a workaround.

We were still on Calabash-Android 0.5.5. So I just updated to 0.5.10. But no change in the behavior.
Phones are all from samsung and running android 5.

Sathish Gogineni

unread,
Jun 10, 2015, 5:56:35 AM6/10/15
to calabash...@googlegroups.com, sathish....@gmail.com
Thanks Youp. it works.

Just to make it clear for others on how to  downgrade WebView ( With lollipop, it becomes an apk in Android system and will get frequent updates )

1. Go to Settings -> App
2. Tap on Android System WebView
3. Tap on Uninstall Updates.

Issue i had with  43.x version. It is working after i downgraded to 37.x, 

Regards,
Sathish

Pop Radu

unread,
Jun 10, 2015, 6:02:43 AM6/10/15
to calabash...@googlegroups.com
I can confirm this works. Had the exact same issue, tried upgrading calabash-android to 5.10 - no success, tried older app version - no success.
Uninstalling the Android System WebView updates has fixed the problem.

Thanks.

Sathish Gogineni

unread,
Jun 10, 2015, 6:17:55 AM6/10/15
to calabash...@googlegroups.com

Chris Fuentes

unread,
Jun 22, 2015, 3:39:53 PM6/22/15
to calabash...@googlegroups.com
Hi all, 

This issue should have been resolved by the latest gem, 0.5.12.pre1

Please let me know if the issue persists. 

Best,
-Chris

Sharon Valento

unread,
Jul 7, 2015, 2:29:47 AM7/7/15
to calabash...@googlegroups.com
Hi All,

With the latest gem , 0.5.12 observed the same issue. But on uninstalling the updates of  Android System WebView, fixed the issue

Regards
Sharon Valento

Youp Hulsebos

unread,
Jul 8, 2015, 10:32:46 AM7/8/15
to calabash...@googlegroups.com
Hi Chris,

Thanks for the update. Our tests are running with the update installed after updatin to the 0.5.12 gem.

Cheers,
Youp

Laurens Schmitz

unread,
Nov 26, 2015, 5:47:10 AM11/26/15
to calabash-android
I'm having this problem too (comes up through xamarin ui tests), now on a nexus 6 that has just been updated to android 6.0..... I cannot uninstal the webview update, since it is the version in the android firmware...

Chris Fuentes

unread,
Nov 27, 2015, 12:33:32 PM11/27/15
to calabash-android, laurens...@gmail.com
Hi Laurens, 

Which version of Xamarin.UITest are you using? The latest version (1.2) should not have this issue. If you are still seeing this, would you mind posting the full issue with details here?

Best,
-Chris 

Dinesh Kumar

unread,
Aug 10, 2016, 5:52:39 AM8/10/16
to calabash-android
Hai,

   I am seeing the below error for the command - wait_for(:timeout => 60) { element_does_not_exist("* id:'splash_progress'")}

Error is - map * id:'splash_progress', query failed because: System services not available to Activities before onCreate()
       (RuntimeError)

This is the first time I am seeing this issue - `System services not available to Activities before onCreate()`. It would be really great if someone provide some info on how to fix this. Thanks.


Calabash-Android version - 0.8.0

Reply all
Reply to author
Forward
0 new messages