appium long press and than move element(drag and drop) is not working

Eric Ipsum picture Eric Ipsum · Mar 18, 2016 · Viewed 8.8k times · Source

I have a scenario to test an IOS app like this:

  1. long press on an element.
  2. move that element to desired location.

I am using the following code:

TouchAction action = new TouchAction(driver)
action.long_press(element1).move_to(element2).wait(500).release().perform()

but its not working for me. Need any good suggestion.

Answer

noor picture noor · Mar 18, 2016

i was in trouble also about this. But i solved this like below:

TouchAction action = new TouchAction(driver);
action.longPress(elem1).waitAction(3000).moveTo(elem2).perform().release();

waitAction will wait to complete longPress action than moveTo action will perform.