October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Use Puppeteer Touchscreen for Mobile Testing

Set up Puppeteer’s mobile viewport before navigation, then use touchscreen taps or low-level touch sequences for mobile browser tests.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To test touch input with Puppeteer, first emulate a mobile device or enable touch in a custom viewport, then use page.touchscreen to send a tap or a lower-level touch sequence. Set up the device or viewport before navigating whenever possible; viewport and touchscreen support are separate parts of the test.

Set up a mobile page before navigation

The examples below use Puppeteer’s documented APIs. Use a device profile when you want its viewport metrics and user agent together. Use a custom viewport when you want to specify those settings yourself. In either case, create the page and configure it before page.goto().

As an Amazon Associate I earn from qualifying purchases.

Emulate a known device

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.touchscreen.tap(120, 240);
} finally {
  await browser.close();
}

page.emulate(device) sets the device’s viewport and user agent. The named profile shown is an example in Puppeteer’s API documentation; confirm it exists in the version installed in your project because the known-device list can change. See the Page.emulate() reference and KnownDevices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set a custom mobile viewport

const page = await browser.newPage();
await page.setViewport({
  width: 390,
  height: 844,
  deviceScaleFactor: 3,
  isMobile: true,
  hasTouch: true,
});
await page.goto('https://example.com');
await page.touchscreen.tap(120, 240);

These dimensions and scale factor illustrate the documented fields; they do not define a specific phone profile or required test values. Width and height are in CSS pixels. Puppeteer documents deviceScaleFactor, isMobile, isLandscape, and hasTouch as viewport options; the documented defaults for device scale factor, mobile mode, and touch support are 1, false, and false. See the Viewport reference and Page.setViewport().

#1 Best Overall
HP 14" HD Touchscreen Notebook Intel N150 4GB RAM 128GB SSD Wireless Mouse + One Year M365 Subscription
  • Take it anywhere. See more: Thin and light design to take anywhere. Flicker-free images on a micro-edge display.
  • Reliable performance for every day: Powerful enough for your busiest days, with an Intel processor and increased responsiveness with 128GB Universal Flash Storage (UFS), this PC also includes the Copilot Key for ease of use and enhanced productivity with AI.
  • Powered up and productive. All day long: Long battery life and HP Fast Charge technology let you work, watch, and stay connected all day. Integrated precision touchpad with multi-touch support speeds up navigation and productivity.
  • Built for a better tomorrow: EPEAT Gold with Climate+ registered, ENERGY STAR certified, and contains sustainable, post-consumer recycled plastics.
  • Make the most out of your 365: Bring your ideas to life. Your creativity now gets a boost with Microsoft 365. Office - Word, Excel, and Power Point - now includes smart assistance features that help make your writing more readable, your data clearer and your presentations more visually powerful. One year subscription included.

Configure emulation before navigation when practical. Puppeteer warns that many websites do not expect phones to change size; changing isMobile or hasTouch through setViewport() may also reload the page. See Page.emulate() and Page.setViewport().

Choose between a device profile and a custom viewport

Approach What it configures Use it when
page.emulate(device) Device metrics and user agent You need a supplied device profile, including its user agent, as well as viewport emulation.
page.setViewport(options) Viewport properties you specify You need control over dimensions, scale factor, mobile mode, orientation, or touch support without choosing a known-device profile.

Both approaches configure the browsing context; neither should be confused with the act of sending a touch. Use page.touchscreen after the page is configured to issue touch input.

Rank #2
Lenovo Essential 15.6" FHD Laptop, Intel Processor, 8GB DDR5, 128GB Storage
  • Efficient Performance for Everyday Computing: Powered by Intel N150 Quad-Core processor (up to 3.6GHz, 6MB cache) with 8GB LPDDR5-4800 RAM and integrated Intel Graphics, delivering smooth multitasking for web browsing, document editing, streaming, and video calls. Pre-installed Windows 11 Home in S mode, English with Microsoft 365 Personal included for productivity right out of the box.
  • Immersive 15.6" FHD Display with Privacy Features: Features a 15.6-inch Full HD (1920x1080) anti-glare display with 250 nits brightness and 88% screen-to-body ratio for an expansive viewing experience. HD 720p camera with built-in privacy shutter protects your privacy when not in use, perfect for secure video conferencing and online learning.
  • Fast Connectivity and Seamless Wireless Performance: Equipped with Wi-Fi 6 (802.11ax) and Bluetooth 5.2 for faster, more reliable wireless connections. Multiple ports including 2x USB-A 5Gbps, 1x USB-C with Power Delivery and DisplayPort, HDMI 1.4, headphone jack, and SD card reader provide versatile connectivity for all your devices and accessories.
  • Portable Design Built for Durability: Weighing just 3.42 lbs with a slim 0.70-inch profile, this laptop is easy to carry anywhere. MIL-STD-810H military-grade tested for reliability and durability. Arctic Grey finish with ergonomic design includes a precision touchpad and full-size keyboard with dedicated AI Copilot hotkey for enhanced productivity.
  • All-Day Computing with Energy-Efficient Storage: 128GB UFS 3.1 storage provides fast boot times and quick file access. User-facing stereo speakers (1.5W x2) with HD audio and dual-array microphones deliver clear sound for entertainment and communication. ENERGY STAR 9.0 certified and EPEAT Silver registered for eco-friendly computing with 65W power adapter included.

Send a tap or a touch sequence

Tap at a coordinate

await page.touchscreen.tap(120, 240);

tap(x, y) dispatches a touchstart followed by touchend at the supplied position. The coordinates are positions in the emulated page viewport. Choose coordinates that correspond to the target after the page has loaded and laid out.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Control the touch lifecycle

const touch = await page.touchscreen.touchStart(120, 240);
await page.touchscreen.touchMove(160, 240);
await page.touchscreen.touchEnd();

touchStart() begins a touch and returns a TouchHandle; touchMove() changes its position, and touchEnd() ends it. This is useful when a test specifically needs to send a low-level touch sequence rather than simply activate an element. Consult the Touchscreen API reference for the API supported by your installed release.

Rank #3
HP 14" Everyday Slim Laptop, 2026 Edition, Intel N150 Processor, 4GB RAM, 128GB SSD, Long Battery Lifes, Copilot AI, Windows 11
  • Efficient Performance for Everyday Tasks: Powered by the Intel Processor and Intel Graphics, this 14-inch laptop delivers smooth performance for browsing, online classes, office tasks, and streaming. Windows 11 Home 64-bit provides a modern, intuitive interface to enhance productivity, huge amounts of storage mean you can save your entire multimedia library on your PC without compromise.
  • Key Features:Enjoy faster, more reliable wireless performance with Wi-Fi 6 (2x2) and Bluetooth 5.4. Includes all the essential ports you need: USB-C, 2× USB-A, HDMI 1.4b, SD media card reader, headphone/microphone combo jack, and AC Smart Pin.A soft Rose Gold finish adds a modern and elegant look to your workspace, making it ideal for students, young professionals, and anyone who prefers a clean and aesthetic setup.
  • Enhanced Video Calls & Smart Input Features: Stay clear and confident in virtual meetings with the HP True Vision 720p HD camera featuring temporal noise reduction and dual array microphones. Includes a full-size keyboard with a dedicated Microsoft Copilot key and a multi-touch HP Imagepad for effortless navigation.
  • Lightweight Design with All-Day Battery Life: Designed for mobility with a sleek Rose Gold chassis weighing just 3.24 lbs. Enjoy up to 11 hours of video playback or 7.5 hours of wireless streaming, making it ideal for school, travel, and everyday use.

Chrome may optimize touch movement: not every touchMove() call necessarily produces a DOM touchmove event. Do not assert that one API call equals one emitted event. Assert the behavior that matters to your test, such as the resulting drag state or displayed value, instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use locators for element actions

If the test is about whether a particular element can be acted on, a locator is generally clearer than calculating coordinates. Puppeteer’s locator interactions check conditions such as viewport presence, visibility, enabled state, and bounding-box stability before acting. Use touchscreen coordinates when the test needs to verify coordinate-based touch input itself. See Puppeteer’s page interactions guide.

Troubleshoot common failures

  • A touch action has no visible effect. Check that the intended page was loaded, the coordinates land inside the target in the current viewport, and the page has touch support enabled through a device profile or hasTouch: true. For ordinary element activation, try a locator action instead of a hard-coded coordinate.
  • The page changes size or reloads during setup. Set the viewport or device profile before page.goto(). Puppeteer notes that changing mobile or touch flags through setViewport() may reload the page.
  • The device profile name is unavailable. The built-in device list can vary by Puppeteer version. Check the KnownDevices exported by the version installed in the project, or define the viewport options explicitly.
  • A test expects one touchmove event for each touchMove() call. Remove that one-to-one assumption; browser optimizations can throttle emitted movement events. Test the interaction outcome instead.

Scope of emulated mobile tests

Puppeteer’s APIs document browser viewport, user-agent, and touch-input emulation. Those references do not establish that an emulated session is equivalent to testing on a physical phone, nor do they provide a device-coverage matrix or comparative reliability data. Use emulation for repeatable browser-level checks, and treat device-specific behavior beyond the documented emulation as something to validate separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

For a website screenshot rather than an interactive touch test, ScreenshotNeo can capture a URL with one GET request. It does not replace Puppeteer’s touch sequence, but it avoids setting up a browser for a static capture.

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

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does Puppeteer touchscreen tap target an element by selector?

No. The touchscreen API takes coordinates; use a locator when the test is about acting on a specific element.

Can I use touchscreen APIs without mobile emulation?

The documented workflow configures a device or viewport with touch support before sending touch input. Set up touch emulation explicitly for mobile tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.