Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need help getting Android to Scroll WD Appium #604

Open
paulaziz-focusatwill opened this issue Sep 14, 2019 · 14 comments
Open

I need help getting Android to Scroll WD Appium #604

paulaziz-focusatwill opened this issue Sep 14, 2019 · 14 comments

Comments

@paulaziz-focusatwill
Copy link

I need help getting Android to Scroll using Javascript WD and Appium

On IOS I have no problem using this command.
await driver.execute("mobile: scroll", { direction: "down" });

On Android I have tried all the touch actions in the appium documentation for WD javascript and have not had any success. Any help would be appreciated.

Thanks

@Nisthar
Copy link

Nisthar commented Feb 1, 2020

updates?

@Nisthar
Copy link

Nisthar commented Feb 2, 2020

Is this library maintained?

@admc
Copy link
Owner

admc commented Feb 3, 2020

Hi @Nisthar - there are a few amazing folks who review and take PR's, but there's very little new development. If you want something that has active development, I would check out @webdriverio. Cheers.

@Nisthar
Copy link

Nisthar commented Feb 3, 2020

@admc Thanks. i have tried webdriverio before. They don't support selecting elements by id. Its hard to use it with appium.

@Nisthar
Copy link

Nisthar commented Feb 4, 2020

@admc I posted an issue for this on appium. They said the parameters used by wd for scroll command is invalid. Do you think its possible to fix this?

@imurchie
Copy link
Collaborator

imurchie commented Feb 5, 2020

@Nisthar Can you post the logs for this? There is no way to fix anything without seeing what you are doing and what is going to the server.

@Nisthar
Copy link

Nisthar commented Feb 5, 2020

@imurchie This is the logs from the appium server:

[HTTP] --> POST /wd/hub/session/5d8de3de-6084-4a10-ac7b-0ebd470e2249/touch/scroll
[HTTP] {"xoffset":10,"yoffset":200}
[MJSONWP (5d8de3de)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Proxying [POST /wd/hub/session/5d8de3de-6084-4a10-ac7b-0ebd470e2249/touch/scroll] to [POST http://localhost:8207/wd/hub/session/ae0d684e-bdf3-4f30-85ac-0eaea3b622ff/touch/scroll] with body: {"xoffset":10,"yoffset":200}
[WD Proxy] Got an unexpected response with status 500: {"sessionId":"ae0d684e-bdf3-4f30-85ac-0eaea3b622ff","value":{"error":"unknown error","message":"com.jayway.jsonpath.InvalidPathException: invalid path","stacktrace":"com.jayway.jsonpath.InvalidPathException: invalid path\n\tat com.jayway.jsonpath.internal.filter.FieldFilter.filter(FieldFilter.java:59)\n\tat com.jayway.jsonpath.JsonPath.read(JsonPath.java:191)\n\tat com.jayway.jsonpath.JsonPath.read(JsonPath.java:211)\n\tat io.appium.uiautomator2.handler.ScrollTo.safeHandle(ScrollTo.java:40)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext...

I created an issue for this in appium. But they are saying its an issue with wd library.
This is the issue on appium: appium/appium#13900

@Nisthar
Copy link

Nisthar commented Feb 5, 2020

@imurchie @admc I also tried the code await new wd.TouchAction(driver).press(750,1750 ).moveTo(0,-75).perform();

This is the server logs for it. It seems like wd is not sending the correct parameters to the server:

[HTTP] <-- POST /wd/hub/session/9a27a189-d3ab-4b32-9bb9-9b68994135f3/element/27e3d359-8505-4054-ba66-b87e21197393/click 200 78 ms - 76
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a27a189-d3ab-4b32-9bb9-9b68994135f3/touch/perform
[HTTP] {"actions":[{"action":"press","options":{}},{"action":"moveTo","options":{}}]}
[MJSONWP (9a27a189)] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{}},{"action":"moveTo","options":{}}],"9a27a189-d3ab-4b32-9bb9-9b68994135f3"]
[WD Proxy] Matched '/touch/down' to command name 'touchDown'
[WD Proxy] Proxying [POST /touch/down] to [POST http://localhost:8207/wd/hub/session/c478494e-2a91-4fa3-ac4d-8984e64e03f0/touch/down] with body: {"params":{"x":0,"y":0}}
[WD Proxy] Got response with status 200: {"sessionId":"c478494e-2a91-4fa3-ac4d-8984e64e03f0","value":null}
[WD Proxy] Matched '/touch/move' to command name 'touchMove'
[WD Proxy] Proxying [POST /touch/move] to [POST http://localhost:8207/wd/hub/session/c478494e-2a91-4fa3-ac4d-8984e64e03f0/touch/move] with body: {"params":{"x":0,"y":0}}
[WD Proxy] Got response with status 200: {"sessionId":"c478494e-2a91-4fa3-ac4d-8984e64e03f0","value":null}
[MJSONWP (9a27a189)] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/9a27a189-d3ab-4b32-9bb9-9b68994135f3/touch/perform 200 1681 ms - 76

@imurchie
Copy link
Collaborator

imurchie commented Feb 5, 2020

For touch actions the functions take objects with x and y properties.

await new wd.TouchAction(driver).press({x: 750, y: 1750}).moveTo({x: 0, y: -75}).perform();

@Nisthar
Copy link

Nisthar commented Feb 6, 2020

@imurchie i also tried that code. Its the same error.

@Nisthar
Copy link

Nisthar commented Feb 8, 2020

any updates on this? @admc

@brunojbarros
Copy link

@Nisthar
This is an example using webdriverIO:

        driver.touchAction([
            { action: 'press', x: 500, y: 1400 },
            { action: 'moveTo', x: 500, y: 300 },
            'release',
            
            { action: 'press', x: 500, y: 1400 },
            { action: 'moveTo', x: 500, y: 300 },
            'release',

            { action: 'press', x: 500, y: 1400 },
            { action: 'moveTo', x: 500, y: 300 },
            'release'
            
        ])

Hope this can help you.
Regards.

@diego-epicura
Copy link

I wonder if anyone test its own code before posting it. The above does not work, the only code I tried that is also working is

await driver.touchAction([{ action: 'longPress', x: 30, y: 500 }, { action: 'moveTo', x: 20, y: 100 }, 'release'])

@admc
Copy link
Owner

admc commented Oct 24, 2022

hi @diego-epicura this project hasn't been working for a very long time, I suggest you check out the webdriver.io ecosystem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants