Skip to content

What's the best way to touch->drag->wait->drag->wait->drop #70

Open

Description

@ErcinDedeoglu

What can we do for you?

Hello guys,
It's clear on the title, I want to drag it to a location and wait there without untouch fired and continue to drag another location.

I tried something like:

await _adbClient.ExecuteRemoteCommandAsync($"sendevent /dev/input/event3 3 57 122", DeviceData, receiver, CancellationToken.None);
await _adbClient.ExecuteRemoteCommandAsync($"sendevent /dev/input/event3 1 330 1", DeviceData, receiver, CancellationToken.None);
await _adbClient.ExecuteRemoteCommandAsync($"sendevent /dev/input/event3 3 53 203", DeviceData, receiver, CancellationToken.None);
await _adbClient.ExecuteRemoteCommandAsync($"sendevent /dev/input/event3 3 54 293", DeviceData, receiver, CancellationToken.None);
await _adbClient.ExecuteRemoteCommandAsync($"sendevent /dev/input/event3 0 0 0", DeviceData, receiver, CancellationToken.None);

But somehow I'm unlucky today. Any advise on this?

Activity

  1. yungd1plomat commented on Aug 21, 2023

    @yungd1plomat
    Member

    I think it is impossible using only pure adb and this lib. Something like this can be done with Appium W3C actions (or deprecated MultiAction/TouchAction).

    Example from python-appium:

    from selenium.webdriver.common.actions import interaction
    from selenium.webdriver.common.actions.action_builder import ActionBuilder
    
    actions = ActionChains(driver)
    # override as 'touch' pointer action
    actions.w3c_actions = ActionBuilder(driver, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
    actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
    actions.w3c_actions.pointer_action.pointer_down()
    actions.w3c_actions.pointer_action.pause(2)
    actions.w3c_actions.pointer_action.move_to_location(internal_x, internal_y)
    actions.w3c_actions.pointer_action.pause(2)
    actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
    actions.w3c_actions.pointer_action.pause(2)
    actions.w3c_actions.pointer_action.release()
    actions.perform()
  2. yungd1plomat commented on Aug 21, 2023

    @yungd1plomat
    Member

    Or the same with dotnet-appium and deprecated TouchActions:

    TouchAction a1 = new TouchAction (driver);
    a1
      .Press (element, start_x, start_y)
      .Wait (1000)
      .MoveTo(internal_x, internal_y)
      .Wait(1000)
      .MoveTo(end_x, end_y)
      .Wait(1000)
      .Release ();
    a1.Perform();
  3. linked a pull request that will close this issueCreate better documentation #85on Nov 17, 2023
  4. linked a pull request that will close this issueCreate better documentation #1on Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions