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

Swipe Method [/wda/dragfromtoforduration] Exhibiting Unexpected Inertia on iOS 17.5.1 #157

Open
exculibar opened this issue Sep 5, 2024 · 0 comments

Comments

@exculibar
Copy link

Description: I have encountered an issue with the swipe method, specifically /wda/dragfromtoforduration, on iOS 17.5.1. The method is not performing as expected, as it introduces unintended inertia during the swipe action. This behavior deviates from the anticipated results and affects the overall reliability of the swipe functionality.

Steps to Reproduce:

Execute the swipe action using the /wda/dragfromtoforduration method on an iOS 17.5.1 device.
Observe that the swipe introduces unintended inertia, contrary to expected behavior.

Expected Behavior: The swipe action should be executed without any additional inertia, providing a consistent and controlled swipe experience.

Actual Behavior: The swipe action includes unintended inertia, which affects the swipe's accuracy and responsiveness.

Environment:

iOS Version: 17.5.1
Method: /wda/dragfromtoforduration

My temporary solution:

import types
import wda


class MyAppiumClient(wda.Client):

    def session(self) -> "MyAppiumClient":
        client = super().session()
        instance = self
        client.swipe_ios = types.MethodType(
            lambda self, x1, y1, x2, y2, duration=0: instance.swipe_ios(
                x1, y1, x2, y2, duration
            ),
            client,
        )
        return client

    def swipe_ios(self, x1, y1, x2, y2, duration=0):
        """
        Args:
            x1, y1, x2, y2 (int, float): float(percent), int(coordicate)
            duration (float): start coordinate press duration (seconds)

        """
        data = {
            "actions": [
                {
                    "type": "pointer",
                    "parameters": {"pointerType": "touch"},
                    "id": "touch",
                    "actions": [
                        {
                            "type": "pointerMove",
                            "duration": 250,
                            "x": x1,
                            "y": y1,
                            "origin": "viewport",
                        },
                        {"type": "pointerDown", "duration": 0, "button": 0},
                        {
                            "type": "pointerMove",
                            "duration": duration * 1000,
                            "x": x2,
                            "y": y2,
                            "origin": "viewport",
                        },
                        {"type": "pointerUp", "duration": 0, "button": 0},
                    ],
                }
            ]
        }
        return self._session_http.post("/actions", data=data)

then

c = MyAppiumClient("http://192.168.2.131:8100")
c.wait_ready()

print(c.app_current())

s = c.session()

s.swipe_ios(150, 350, 150, 200, 3)
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

1 participant