Playwright
// Enable touch for mobile emulation
const context = await browser.newContext({
...devices['iPhone 14'],
hasTouch: true
});
// Tap
await page.tap('[data-testid="touch-area"]');
// Double tap
await page.tap('[data-testid="touch-area"]');
await page.tap('[data-testid="touch-area"]');
// Long press using touchscreen
await page.touchscreen.tap(200, 200);
await page.waitForTimeout(600);
// Or with mouse (for testing)
await page.locator('[data-testid="touch-area"]')
.click({ delay: 600 });Appium (Native)
// Single tap
driver.findElement(By.id("touch-area")).click();
// Double tap
TouchAction action = new TouchAction(driver);
action.doubleTap(element).perform();
// Long press
action.longPress(element)
.waitAction(Duration.ofMillis(600))
.release()
.perform();
// With coordinates
action.tap(PointOption.point(200, 300))
.perform();