Unable to scroll/swipe
See original GitHub issueI started to use Appium: 1.9.0 with appium-espresso-driver for the testing with webdriver. However, I cannot get scrolling/swiping working.
I tried below:
browser.touchDown(10, 900);
browser.touchMove(10, 10);
browser.touchUp(10,10);
It doesn’t give any error, but it doesn’t do anything on the page (the same happens if I use “browser.touchPerform
” or “browser.touchAction
”).
browser.performTouchAction([{ action: 'press', options: { x: 1945, y: 1255 } }]); browser.performTouchAction([{ action: 'moveTo', options: { x: 66, y: 470 } }]); browser.performTouchAction([{ action: 'release', options: {} }]);
Gives the following error:
An unknown server-side error occurred while processing the command. Original error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) at com.google.gson.Gson.fromJson(Gson.java:888) at com.google.gson.Gson.fromJson(Gson.java:853) at com.google.gson.Gson.fromJson(Gson.java:802) at com.google.gson.Gson.fromJson(Gson.java:774) at io.appium.espressoserver.lib.http.Router.route(Router.java:240) at io.appium.espressoserver.lib.http.Server.serve(Server.java:62) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) … 10 more
Using browser.scroll(element_selector, 50, 900);
gives me the following error:
An unknown server-side error occurred while processing the command. Original error: java.lang.NullPointerException: Attempt to invoke virtual method ‘long java.lang.Long.longValue()’ on a null object reference at io.appium.espressoserver.lib.handlers.PointerEventHandler.handleTouchScroll(PointerEventHandler.java:217) at io.appium.espressoserver.lib.handlers.PointerEventHandler.handle(PointerEventHandler.java:92) at io.appium.espressoserver.lib.handlers.PointerEventHandler.handle(PointerEventHandler.java:35) at io.appium.espressoserver.lib.http.Router.route(Router.java:251) at io.appium.espressoserver.lib.http.Server.serve(Server.java:62) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:764)
I tried few more methods to scroll vertically or swipe horizontally but pretty much all of them give me one of the above results. I would like to use this driver for our testing as it gives us an easy way to access elements. However, I need to have the scrolling.swiping functionality and I cannot get it working. Is there a way to do it with the current version of the driver?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Please find below the appium logs for the following commands. If you need some more logs for any particular commands please let me know:
browser.performTouchAction([{ action: 'press', options: { x: 1945, y: 1255 } }]);
browser.scroll(element_selector, 50, 900);
So, I’m pretty sure the issue with this:
Is that they shouldn’t be arrays, but individual objects.
As for the first one:
This should be fixed with the latest version (try installing
npm uninstall -g appium && npm install -g appium@beta
). It was usingmouse
pointer by default before, now it usestouch
.