Use await page.tap('button.submit') to send a touch tap to the first matching element. Puppeteer scrolls it into view if needed and taps its center. For ordinary element interactions, Puppeteer recommends locators, which wait for the element and for it to be ready to act on.
Tap an element with a selector
The direct Page API takes a selector string:
await page.tap('button.submit');
page.tap(selector) scrolls the matched element into view when necessary, then taps its center through Puppeteer’s touchscreen input. It throws if the selector matches no element. If more than one element matches, it taps the first one, so use a selector specific to the intended target. Puppeteer Page.tap() reference.
As an Amazon Associate I earn from qualifying purchases.
Prefer a locator for a normal element workflow
Puppeteer’s interaction guide recommends locators for selecting and interacting with elements. A locator automatically waits for the element to be present and in an actionable state:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →await page.locator('button.submit').tap();
Choose this form when the page may still be rendering or the target may not yet be ready. Use page.tap(selector) when its concise selector-based behavior fits the step. If your project supports multiple Puppeteer releases, check the installed version’s API before relying on a method.
#1 Best Overall
Puppeteer page interactions guide.
Choose touch, mouse, or coordinates
- Touch a selected element: Use
page.locator(selector).tap()for locator-driven interaction, orpage.tap(selector)for the direct Page method. Both target the element rather than requiring you to calculate its position. - Touch an element handle: If you already hold an
ElementHandle, callawait elementHandle.tap(). Puppeteer scrolls it into view if needed and taps its center. It throws if the element has detached from the DOM; reacquire the handle after page changes. ElementHandle.tap() reference. - Touch a viewport coordinate: Call
await page.touchscreen.tap(x, y), wherexis the horizontal andythe vertical position. This dispatchestouchstartfollowed bytouchend. Use it when the position itself is what matters. Touchscreen.tap() reference. - Send a mouse click: Use
page.click(selector)when the page should receive mouse input. Puppeteer treats mouse and touch as distinct input mechanisms; a click is not a substitute when you need to test touch behavior. Page interactions guide.
Emulate a mobile device before navigating
For a mobile-device context, emulate the device before opening the page. Puppeteer’s page.emulate() sets the user agent and viewport; doing it before navigation avoids changing those settings after the site has loaded, which can affect its behavior.
import puppeteer, {KnownDevices} from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.emulate(KnownDevices['iPhone 17 Pro']);
await page.goto('https://example.com');
await page.locator('button.submit').tap();
} finally {
await browser.close();
}
Use a device name available in the KnownDevices export for the Puppeteer version installed in your project. The current Page.emulate() reference shows the iPhone 17 Pro example.
Troubleshoot taps that do not work
- No matching element: The direct Page method throws if no element matches. Check the selector and whether the target exists when the action runs; a locator can wait for an element to appear.
- The wrong matching element is tapped:
page.tap(selector)chooses the first match. Narrow the selector to identify the intended element. - An element handle is detached: The page may have replaced or removed the node. Query for a fresh handle after the page changes, or use a locator-based interaction.
- The page reacts differently than expected: Verify the input type.
page.click()sends mouse input; the tap APIs send touch input. - The mobile layout is unexpected: Configure emulation before navigation. Changing the user agent or viewport after loading can affect site behavior.
Or skip the browser setup
If your goal is a screenshot rather than testing a touch interaction, ScreenshotNeo returns a screenshot or PDF from one GET request. It does not tap page elements, but can remove cookie banners, newsletter popups and chat widgets before capture. Bot checks, blank pages and failed loads are not billed; an MCP server lets AI agents take screenshots; 1,000 screenshots a month are free with no card, and paid plans start at $5 for 3,000.
cURL example and ScreenshotNeo API documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Sign up for 1,000 free screenshots a month, with no card.
Quick Recap
Rank #3
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




