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

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

Open
ErcinDedeoglu opened this issue Aug 21, 2023 · 2 comments
Open

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

ErcinDedeoglu opened this issue Aug 21, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ErcinDedeoglu
Copy link

ErcinDedeoglu commented Aug 21, 2023

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?

@ErcinDedeoglu ErcinDedeoglu added the help wanted Extra attention is needed label Aug 21, 2023
@yungd1plomat
Copy link
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()

@yungd1plomat
Copy link
Member

yungd1plomat commented Aug 21, 2023

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants