AdvancedSharpAdbClient
AdvancedSharpAdbClient copied to clipboard
What's the best way to touch->drag->wait->drag->wait->drop
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?
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()
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();