Help to use mobile:command for Espresso driver


#1

Hi

I am trying to execute mobile:command actions using Espresso driver
The endpoing is /wd/hub/session/<session-id>/execute
I’m trying to swipe by using mobile:swipe

The doc says

mobile:swipe Perform the “swipe” view action {elementId, direction} `{elementId: 2, direction: “down|up|left|right”}

I do perform the swipe with this args

{
    "args": [
        {
            "element": "97823c9a-d61c-46fa-8020-b576a2bca2a4",
            "direction": "down"
        }
    ],
    "script": "mobile: swipe"
}

and getting this output

{“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command. Original error: androidx.test.espresso.PerformException: Error performing ‘fast swipe’ on view ‘Looked for element with View com.facebook.react.views.view.ReactViewGroup{7d89bf6 VFE… … 0,1800-1080,1958 #7dd}’.\n\tat androidx.test.espresso.PerformException$Builder.build(PerformException.java:84)\n\tat androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:85)\n\tat androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:57)\n\tat androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:316)\n\tat androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:177)\n\tat androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:118)\n\tat io.appium.espressoserver.lib.handlers.MobileSwipe.handle(MobileSwipe.kt:41)\n\tat io.appium.espressoserver.lib.handlers.MobileSwipe.handle(MobileSwipe.kt:30)\n\tat io.appium.espressoserver.lib.http.Router.route(Router.java:335)\n\tat io.appium.espressoserver.lib.http.Server.serve(Server.java:69)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:764)\nCaused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:\nat least 90 percent of the view’s area is displayed to the user.\nTarget view: “ReactViewGroup{id=2013, desc=Settings. Button, visibility=VISIBLE, width=1080, height=158, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, [email protected], tag=more_services_feedback, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=1800.0, child-count=2}”\n\tat androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:248)\n\tat androidx.test.espresso.ViewInteraction.access$100(ViewInteraction.java:64)\n\tat androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:157)\n\tat androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:154)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat android.os.Handler.handleCallback(Handler.java:873)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loop(Looper.java:193)\n\tat android.app.ActivityThread.main(ActivityThread.java:6669)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)\n”},“sessionId”:“35e84113-daf8-46c8-9e8d-e118002929fb”}

Please note, that if elementId is passed instead of element as doc says, I get this error:

{“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command. Original error: The following options are required: [“element”]. You have only provided: [“elementId”,“direction”]”},“sessionId”:“35e84113-daf8-46c8-9e8d-e118002929fb”}

Appium version is v1.12.1


#2

It works. The element should have visible=true


#3

Action will not be performed because the target view does not match one or more of the following constraints:\nat least 90 percent of the view’s area is displayed to the user