title: Katalon iOS mobile automation, is it possible to make a custom keyword that will long press and move element(drag and drop)
body: <p>Currently I'm having some problem using Drag and Drop keyword in katalon, since the object that I need to drag should be tapped (for like 1 sec) before it pop-out and be moveable but since the "drag and drop" keyword works instantly without any timeout on the first action (drag). Now has anyone tried using a custom keyword for this kind of issue?</p>
  
  <p>Thank you so much in advance.</p>
  
  <p>Currently this is the only code that I am trying to convert in mobile since it was originally created for web, I'm not very sure if I am doing it right.</p>
  
  <pre><code>package aCustomDragmDrop
  import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
  import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
  import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
  import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
  
  import com.kms.katalon.core.annotation.Keyword
  import com.kms.katalon.core.checkpoint.Checkpoint
  import com.kms.katalon.core.checkpoint.CheckpointFactory
  import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
  import com.kms.katalon.core.model.FailureHandling
  import com.kms.katalon.core.testcase.TestCase
  import com.kms.katalon.core.testcase.TestCaseFactory
  import com.kms.katalon.core.testdata.TestData
  import com.kms.katalon.core.testdata.TestDataFactory
  import com.kms.katalon.core.testobject.ObjectRepository
  import com.kms.katalon.core.testobject.TestObject
  import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords
  import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords
  
  import internal.GlobalVariable
  
  import MobileBuiltInKeywords as Mobile
  import WSBuiltInKeywords as WS
  import WebUiBuiltInKeywords as WebUI
  
  import org.openqa.selenium.WebElement
  import org.openqa.selenium.WebDriver
  import org.openqa.selenium.By
  
  import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
  import com.kms.katalon.core.webui.driver.DriverFactory
  
  import com.kms.katalon.core.testobject.RequestObject
  import com.kms.katalon.core.testobject.ResponseObject
  import com.kms.katalon.core.testobject.ConditionType
  import com.kms.katalon.core.testobject.TestObjectProperty
  
  import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
  import com.kms.katalon.core.util.KeywordUtil
  
  import com.kms.katalon.core.webui.exception.WebElementNotFoundException
  
  import io.appium.java_client.AppiumDriver
  import io.appium.java_client.MobileElement
  import io.appium.java_client.TouchAction
  
  public class DragDrop {
  
      @Keyword
      def dragdrop(TestObject to,TestObject destination,Integer intX,Integer intY) {
      def Eleto = MobileElementCommonHelper.findElement(to, timout)
      def eledest = MobileElementCommonHelper.findElement(destination, timeout)   
      TouchAction touchAction = new TouchAction(driver)
      touchAction.moveToElement(eleto)
      touchAction.waitAction(WaitOptions.waitOptions(Duration.ofMillis(2000)))
      touchAction.perform()
      touchAction.moveToElement(eledest,intX, intY)
      touchAction.release()
      touchAction.perform();
  }
  }
  </code></pre>