Could you please assist with a method for long press or press and hold that can be used in a Mocha with Appium project?

Could you please assist with a method for long press or press and hold that can be used in a Mocha with Appium project?

Hello Richard.hall,

In Mocha.js itself, there is no built-in function to interact with UI as it is primarily a test framework and does not provide UI interaction capabilities.

However, One popular library for UI automation in JavaScript is WebDriverIO. It provides a convenient interface for interacting with web elements and simulating user actions. You can try the below code and let me know if this works:

await targetElement.touchAction([
      { action: 'press', x: 0, y: 0 },
      { action: 'wait', ms: 3000 }, 
      { action: 'release' }
    ]);