Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: clicking hidden input should not crash/timeout (#18410)

Dmitry Gozman90cf2b87b4f0
diff --git a/tests/page/page-click-scroll.spec.ts b/tests/page/page-click-scroll.spec.ts
index d0207a857a..15ff60e11a 100644
--- a/tests/page/page-click-scroll.spec.ts
+++ b/tests/page/page-click-scroll.spec.ts
@@ -77,3 +77,12 @@ it('should scroll into view display:contents with position', async ({ page, brow
await page.click('text=click me', { position: { x: 5, y: 5 }, timeout: 5000 });
expect(await page.evaluate('window._clicked')).toBe(true);
});
+
+it('should not crash when force-clicking hidden input', async ({ page, browserName }) => {
+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18183' });
+ it.fixme(browserName === 'chromium');
+
+ await page.setContent(`<input type=hidden>`);
+ const error = await page.locator('input').click({ force: true, timeout: 2000 }).catch(e => e);
+ expect(error.message).toContain('Element is not visible');
+});