Try doing this:
await button.evaluate(b => b.click());
instead of
await button.click();
The difference is that button.evaluate(b => b.click()) runs the JavaScript HTMLElement.click() method on the given element in the browser context, which will fire a click event on that element even if it’s hidden, off-screen or covered by a different element, whereas button.click() clicks using Puppeteer’s ElementHandle.click() which
- scrolls the page until the element is in view
- gets the bounding box of the element (this step is where the error happens) and finds the screen x and y pixel coordinates of the middle of that box
- moves the virtual mouse to those coordinates and sets the mouse to “down” then back to “up”, which triggers a click event on the element under the mouse