Forum Discussion

mikkdev's avatar
mikkdev
New Contributor
11 days ago

TouchPress and TouchAction Not Working in TestComplete with Appium

TouchPress and TouchAction Not Working in TestComplete with Appium

I am encountering an issue while automating a mobile application using Appium and Python in TestComplete. Specifically, the TouchPress and TouchAction methods are not functioning as expected. Below are the details of the problem:

Steps to Reproduce:

I attempted to use the following code to perform a TouchPress action on a button in the app:

    def touchPressPresentButton():
      x = _getPresentButton().ScreenLeft
      y = _getPresentButton().ScreenTop
      Mobile.Device().TouchPress(x, y)

    def touchReleasePresentButton():
      x = _getPresentButton().ScreenLeft
      y = _getPresentButton().ScreenTop
      Mobile.Device().TouchRelease(x, y)

When running this code, I encounter the following exception: "Unable to perform the specified touch action on the device."

I also tested the TouchAndHold method, which works without exceptions but does not meet my requirements because it is synchronous. My intent is to check GUI elements dynamically while the button is being held.

Here is the TouchAndHold code snippet:

def touchAndHold(duration: int = 5000):
    x = _getPresentButton().ScreenLeft
    y = _getPresentButton().ScreenTop
    Mobile.Device().TouchAndHold(x, y, duration)

Expected Behavior:

The TouchPress method should perform a press action on the specified screen coordinates without throwing an exception. Similarly, the TouchRelease should complement this by releasing the press at the coordinates.

Actual Behavior:

The methods TouchPress and TouchRelease throw the exception: "Unable to perform the specified touch action on the device."

Environment Details:

  • TestComplete Version: v15.70.4.7 (x64)
  • Appium Version: v2.13.1
  • Android: v13.0
  • Programming Language: Python
  • Did this ever work for you? If so, what has changed since then?

    • mikkdev's avatar
      mikkdev
      New Contributor

      No, this has never worked for me.

      I am working on implementing the TouchPress and TouchRelease methods for the first time in TestComplete with Appium. The methods are throwing the exception:
      "Unable to perform the specified touch action on the device."