Puppeteer click() fails because the element has no usable box
Fix it fast
Most common cause, 1 of 3The selector's first match is a hidden copy of the element
Make the selector match only the element people click: scope it to the visible container, use a test attribute, or select by text with Puppeteer's ::-p-text() selector.
// a selector that matches one element
await page.locator('[data-testid="pay-now"]').click();
// or choose the visible one among several matches
const handles = await page.$$('#checkout button.pay');
for (const h of handles) {
if (await h.isVisible()) { await h.click(); break; }
}Short answer
Puppeteer throws Node is either not clickable or not an Element (old releases: not visible or not an HTMLElement) when the element has no clickable box: the selector hit a hidden copy, the element is not shown yet, or it has zero size. Use a locator, which waits for a visible, stable element, or click what users see (Puppeteer 25).
Which cause do you have?
Print every element the selector matches, with Puppeteer's own visibility verdict and box, right where the click fails. Several matches with a null box first is cause 1. A single match that is hidden now but fine a second later is cause 2. A box that exists but has width or height 0 is cause 3.
const handles = await page.$$('#checkout button.pay');
for (const [i, h] of handles.entries()) {
console.log(i, await h.isVisible(), await h.boundingBox());
}Then find the line you see in this list and open its fix:
- 1The selector's first match is a hidden copy of the element
page.$$ returns two or more handles; the first logs false and null, a later one logs true and a real box - 2The element is in the DOM but not displayed yet when click() runs
One match; isVisible() is false at the failing moment, and the same click works after a short delay or on a retry - 3The element is rendered with zero width or height
boundingBox() returns an object, not null, but width or height is 0; isVisible() is false
What does the error look like?
Error: Node is either not clickable or not an ElementError: Node is either not clickable or not an HTMLElementError: Node is either not visible or not an HTMLElement
Cause 1 of 3
The selector's first match is a hidden copy of the element
You seepage.$$ returns two or more handles; the first logs false and null, a later one logs true and a real box
Check
click() and hover() call clickablePoint(), which throws Node is either not clickable or not an Element when the element has no client rects of at least 1x1 pixel. page.$ returns the first element that matches, and a responsive page may keep a second copy of the same button (a mobile menu or a closed drawer) under display: none, ahead of the visible one. boundingBox() then returns null, which the docs say means the element is not part of the layout.
console.log(await page.$$eval('#checkout button.pay', els => els.length));Fix
Make the selector match only the element people click: scope it to the visible container, use a test attribute, or select by text with Puppeteer's ::-p-text() selector. If the markup cannot change, pick the first handle that Puppeteer reports as visible.
// a selector that matches one element
await page.locator('[data-testid="pay-now"]').click();
// or choose the visible one among several matches
const handles = await page.$$('#checkout button.pay');
for (const h of handles) {
if (await h.isVisible()) { await h.click(); break; }
}Verify
The diagnostic loop now prints a single match with true and a box, and the click goes through.
console.log(await page.$$eval('[data-testid="pay-now"]', els => els.length)); // 1Confirmed by raw.githubusercontent.com
Cause 2 of 3
The element is in the DOM but not displayed yet when click() runs
You seeOne match; isVisible() is false at the failing moment, and the same click works after a short delay or on a retry
Check
An element can exist in the DOM before the app shows it: a modal that opens with an animation, a button revealed after data loads, or a form step that is still display: none. page.$ and waitForSelector without options return as soon as the node exists, so the click arrives while it has no box. waitForSelector only waits for visibility when visible: true is passed, and that option defaults to false.
console.log(await (await page.$('#confirm')).isVisible());Fix
Use a locator. Puppeteer's locator click waits for the element to be in the viewport, visible, enabled and to keep a stable bounding box for two animation frames, then clicks. With the older handle API, wait with visible: true first.
// preferred: the locator waits for all preconditions
await page.locator('#confirm').click();
// handle API: wait until it is visible, then click
const confirm = await page.waitForSelector('#confirm', { visible: true });
await confirm.click();Verify
Repeat the run five times, also on the slower CI runner. Each run clicks through with no added sleep.
for i in 1 2 3 4 5; do node scripts/checkout.mjs || break; doneConfirmed by pptr.dev
Cause 3 of 3
The element is rendered with zero width or height
You seeboundingBox() returns an object, not null, but width or height is 0; isVisible() is false
Check
Puppeteer looks for a client rect that is at least 1 pixel wide and 1 pixel high, and its isVisible() check requires a non-empty bounding rect. A custom checkbox or radio button whose real input is styled to width: 0 or height: 0 behind a decorated label is the typical case: users see a control, yet the element the selector picks has no area to aim at.
console.log(await (await page.$('input#terms')).boundingBox());Fix
Click the element that carries the visible area, usually the label or wrapper. When the zero-size input must receive the action, call the DOM method click() on it inside the page; it simulates a mouse click by firing the element's click event, with no coordinates needed (a disabled input ignores it).
// click what users actually see
await page.locator('label[for="terms"]').click();
// or trigger the input itself without mouse coordinates
const terms = await page.$('input#terms');
await terms.evaluate(el => el.click());Verify
The input changes state after the action.
console.log(await page.$eval('input#terms', el => el.checked)); // trueConfirmed by pptr.dev
How do I stop it coming back?
- Prefer page.locator(...).click() over page.$ followed by click(); the locator retries until the element is visible, enabled and has a stable box.
- Add data-testid attributes to the buttons your scripts drive, so one selector maps to one element across desktop and mobile layouts.
- In the catch block of a failing click, log isVisible() and boundingBox() for the handle, so a CI failure shows which of the three cases happened.
Sources
- Puppeteer source: ElementHandle (current)
- Puppeteer source: JSHandle in v1.20.0 (old message)
- Puppeteer source: JSHandle in v13.0.0
- Puppeteer: page interactions and locators
- Puppeteer: WaitForSelectorOptions
- Puppeteer: ElementHandle.isVisible()
- Puppeteer: ElementHandle.boundingBox()
- Puppeteer: Page.$()
- MDN: HTMLElement.click()
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.