Long press on Widows object

Hi. How I can Long Press to object in Katalon Studio Windows App?

Hi @vigla06,

You can create a custom keyword to simulate long press option like this:

import java.time.Duration

import org.openqa.selenium.WebElement
import org.openqa.selenium.interactions.Actions

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.testobject.WindowsTestObject
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import io.appium.java_client.AppiumDriver
import io.appium.java_client.TouchAction
import io.appium.java_client.touch.LongPressOptions
import io.appium.java_client.touch.offset.ElementOption

public class WindowsEnhancedKeyword {
	 * @param targetObject the object to press
	 * @param holdTime hold time in millisecond
	def static longPress(WindowsTestObject targetObject, long holdTime) {
		WebElement toElement = Windows.findElement(targetObject)

		AppiumDriver<?> driver = Windows.getDriver()

		TouchAction longPress = new TouchAction(driver)
					.withElement(ElementOption.element(toElement, 1, 1)))

Thank you!

It’s work, but like Click… not like Long Click… Can I change click timing maybe?

It’s actually the long click with a specified hold time. You can increase the hold time to a bigger number in milliseconds.

increased. but it still works like a normal click…

I have Error . Maybe it’s relevant?

Hi, I still need help to scroll down to Element in Windows App…
Thank you