Skip to end of metadata
Go to start of metadata

Instead of using 'Swipe' keyword which requires you to pass in coordinates, you can utilize supported backend mobile gestures from Appium. Below is sample custom keyword:

import org.openqa.selenium.JavascriptExecutor
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver	
 
    @Keyword
	def swipeDirection(String direction){
		JavascriptExecutor js = (JavascriptExecutor) getCurrentSessionMobileDriver()
		HashMap<String, String> scrollObject = new HashMap<String, String>()
		scrollObject.put("direction", direction)
		js.executeScript("mobile: swipe", scrollObject)
	}

	@Keyword
	def AppiumDriver getCurrentSessionMobileDriver() {
		return MobileDriverFactory.getDriver();
	}
  • No labels