admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 404 forks source link

I need help getting Android to Scroll WD Appium #604

Open paulaziz-focusatwill opened 4 years ago

paulaziz-focusatwill commented 4 years ago

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 commented 4 years ago

updates?

Nisthar commented 4 years ago

Is this library maintained?

admc commented 4 years ago

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 commented 4 years ago

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

Nisthar commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

@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: https://github.com/appium/appium/issues/13900

Nisthar commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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

Nisthar commented 4 years ago

any updates on this? @admc

brunojbarros commented 3 years ago

@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 commented 1 year ago

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 commented 1 year ago

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