What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use page.mouse.down() to press a mouse button and page.mouse.up() to release it. Await both calls. The button stays held between them, so you can run other actions during that interval.
Press and release a mouse button
Each Puppeteer Page has a mouse object. Call its down() and up() methods separately when you need explicit control over how long the button remains pressed:
As an Amazon Associate I earn from qualifying purchases.
await page.mouse.down();
// The left button remains held while intervening actions run.
await page.mouse.up();
The default button is left. To use another supported button, pass the same button choice to both calls:
Free tools Windows power users keep installed
One-click scans. No signup required.
await page.mouse.down({ button: 'right' });
// Run an action while the right button is held.
await page.mouse.up({ button: 'right' });
Puppeteer documents left, right, middle, back, and forward as button values. Use the same selection on release so the button you pressed is the one you release.
#1 Best Overall
Choose the right interaction API
| What you need | Use | Why |
|---|---|---|
| A click at a specific coordinate | page.mouse.click(x, y) |
It is the coordinate-click shortcut for moving to the point, pressing, and releasing. |
| A press that remains held while other actions run | page.mouse.down(), then page.mouse.up() |
Separate calls give you explicit control over the press and release. |
| Clicking a page element | page.locator(selector).click() |
Puppeteer’s guide recommends locators; they check that the element is in the viewport, visible, enabled, and has a stable bounding box before clicking. |
Use page.mouse when you need mouse events at a position rather than an element-directed click. For ordinary interaction with a known DOM element, a locator can handle the documented readiness checks for you.
Complete example with a reliable release
This example creates a page, presses the left button at a viewport coordinate, runs an intervening action, and releases the button even if that action throws an error. Replace the URL and coordinates with values appropriate to your page.
Rank #2
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
const x = 200;
const y = 150;
await page.mouse.move(x, y);
await page.mouse.down();
try {
// Perform the action that must happen while the button is held.
await page.waitForTimeout(500);
} finally {
await page.mouse.up();
}
} finally {
await browser.close();
}
})();
The nested finally matters if an intervening operation can fail: without it, execution might skip mouse.up() and leave the input state pressed for later actions on that page. If your Puppeteer version does not provide page.waitForTimeout(), replace that illustrative delay with the real operation you need to perform while holding the button.
Understand coordinates and event limits
page.mouse coordinates are CSS pixels relative to the main frame’s viewport, with the origin at its top-left corner. They are not document coordinates for the full page. A point’s target can change after scrolling, resizing the viewport, or changing page layout, so establish the desired viewport and page state before choosing coordinates.
Puppeteer’s mouse operations trigger synthetic MouseEvents; they do not reproduce every behavior of a physical mouse. The API documentation specifically notes that page.mouse cannot perform dragging or text selection. If a task depends on those interactions, do not assume that a sequence of down(), movement, and up() will faithfully reproduce a user’s physical input.
Troubleshoot common problems
- The button seems to remain pressed: Make sure the code reaches and awaits
page.mouse.up(). Put the release in afinallyblock when intervening work may throw. - The wrong button is released: Pass the same
buttonoption to bothdown()andup(). If omitted, each call uses the default,left. - The action happens at the wrong place: Check that the coordinates are viewport-relative CSS pixels in the main frame, and that the viewport and page layout have not changed since you chose them.
- A drag or text selection does not behave like a person’s: This is a limitation of Puppeteer’s synthetic mouse events; its documentation says these operations cannot perform dragging or selecting text.
- An element click is unreliable: Prefer
page.locator(selector).click()for a DOM element so Puppeteer can perform its documented visibility, enabled-state, viewport, and bounding-box checks.
Or skip the browser setup
If your goal is to get a screenshot rather than control a held mouse button, ScreenshotNeo returns a page capture from one GET request. It does not replace Puppeteer’s mouse API for pressing and releasing a button.
Rank #4
For example, save a screenshot of Stripe as WebP with cURL:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Quick Recap
Best Value
- Used Book in Good Condition
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.
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.




