diff --git a/src/common/JSHandle.ts b/src/common/JSHandle.ts index 03e9102ce70..adeb960576c 100644 --- a/src/common/JSHandle.ts +++ b/src/common/JSHandle.ts @@ -421,7 +421,7 @@ export class ElementHandle< this._client.send('Page.getLayoutMetrics'), ]); if (!result || !result.quads.length) - throw new Error('Node is either not visible or not an HTMLElement'); + throw new Error('Node is either not clickable or not an HTMLElement'); // Filter out quads that have too small area to click into. // Fallback to `layoutViewport` in case of using Firefox. const { clientWidth, clientHeight } = @@ -433,7 +433,7 @@ export class ElementHandle< ) .filter((quad) => computeQuadArea(quad) > 1); if (!quads.length) - throw new Error('Node is either not visible or not an HTMLElement'); + throw new Error('Node is either not clickable or not an HTMLElement'); // Return the middle point of the first quad. const quad = quads[0]; let x = 0; diff --git a/test/elementhandle.spec.ts b/test/elementhandle.spec.ts index f65027fcea6..8eeba003f0d 100644 --- a/test/elementhandle.spec.ts +++ b/test/elementhandle.spec.ts @@ -228,7 +228,7 @@ describe('ElementHandle specs', function () { ); const error = await button.click().catch((error_) => error_); expect(error.message).toBe( - 'Node is either not visible or not an HTMLElement' + 'Node is either not clickable or not an HTMLElement' ); }); it('should throw for recursively hidden nodes', async () => { @@ -242,7 +242,7 @@ describe('ElementHandle specs', function () { ); const error = await button.click().catch((error_) => error_); expect(error.message).toBe( - 'Node is either not visible or not an HTMLElement' + 'Node is either not clickable or not an HTMLElement' ); }); it('should throw for
elements', async () => { @@ -252,7 +252,7 @@ describe('ElementHandle specs', function () { const br = await page.$('br'); const error = await br.click().catch((error_) => error_); expect(error.message).toBe( - 'Node is either not visible or not an HTMLElement' + 'Node is either not clickable or not an HTMLElement' ); }); });