[Python][Appium][Uiautomator2]The requested resource could n
2024-03-26 02:47

I'm facing problem with scrolling in Android tests with Appium and UiAutomator

Appium v2.5.1 [email protected]

Log:

[HTTP] --> POST /wd/hub/session/30ea7661-385b-4642-a3c3-b64346a5fe84/touch/perform [HTTP] {"actions":[{"action":"press","options":{"x":0,"y":755}},{"action":"moveTo","options":{"x":0,"y":50}},{"action":"release","options":{}}]} [AndroidUiautomator2Driver@c0a4 (30ea7661)] Command 'performTouch' has been deprecated and will be removed in a future version of Appium or your driver/plugin. Please use a different method or contact the driver/plugin author to add explicit support for the command before it is removed [AndroidUiautomator2Driver@c0a4 (30ea7661)] Driver proxy active, passing request on via HTTP proxy [AndroidUiautomator2Driver@c0a4 (30ea7661)] Matched '/wd/hub/session/30ea7661-385b-4642-a3c3-b64346a5fe84/touch/perform' to command name 'performTouch' [AndroidUiautomator2Driver@c0a4 (30ea7661)] Proxying [POST /wd/hub/session/30ea7661-385b-4642-a3c3-b64346a5fe84/touch/perform] to [POST http://127.0.0.1:8200/session/bee258ad-6bbe-4b77-9413-236b6fb3172e/touch/perform] with body: {"actions":[{"action":"press","options":{"x":0,"y":755}},{"action":"moveTo","options":{"x":0,"y":50}},{"action":"release","options":{}}]} [AndroidUiautomator2Driver@c0a4 (30ea7661)] Got response with status 404: {"sessionId":null,"value":{"error":"unknown command","message":"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource","stacktrace":"io.appium.uiautomator2.common.exceptions.UnknownCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:84)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)\n\tat io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandler...

How can I solve this problem?

I tried to run this without /wd/hub but still face the same issue( And I tried to downgrade Appium to 2.2.2 and UIautomator to 2.43.4 and same result again but without message about deprecation(




other answer :

It seems like youre encountering an issue with scrolling in your Android tests using Appium and UiAutomator2. The error message suggests that the requested resource could not be found, which indicates there might be a problem with the command youre trying to execute or the HTTP method being used.

The log also mentions that the performTouch command has been deprecated and will be removed in a future version of Appium or your driver/plugin. You should consider using a different method for scrolling or updating your driver/plugin to support the newer commands.

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

Check Appium and UiAutomator2 versions: Ensure that you are using compatible versions of Appium and UiAutomator2. Sometimes, compatibility issues can arise if the versions are not aligned.

Update your Appium and UiAutomator2 dependencies: If youre using outdated versions, updating to the latest versions might resolve the issue, as it could include bug fixes or improvements related to scrolling functionality.

Review the scrolling code: Double-check the code responsible for scrolling to ensure there are no errors or inconsistencies. Make sure youre using the correct method for scrolling according to the documentation.

Consider alternative scrolling methods: Instead of using the deprecated performTouch command, explore alternative methods provided by Appium and UiAutomator2 for scrolling. This might involve using swipe gestures or other UI interaction commands.

Inspect the UI hierarchy: Sometimes, scrolling issues can occur due to changes in the UI hierarchy. Use UI inspection tools to verify that the elements youre trying to scroll to are accessible and correctly identified by your test scripts.

Check for network or server issues: The 404 error could also indicate a problem with the server or network connectivity. Ensure that the Appium server is running correctly and there are no network issues affecting communication between your test scripts and the device/emulator.

By following these steps and addressing any potential issues, you should be able to troubleshoot and resolve the scrolling problem in your Android tests with Appium and UiAutomator2.