mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(page): page.click should work with disabled javascript (#2907)
Unfortunately, disabling javascript in page prevents any microtasks to be executed even from puppeteer-originating javascript. As a result, the IntersectionObserver hack we use to conditionally scroll into view doesn't work. To workaround this, we start always scrolling before clicking if page's javascript is disabled. Fixes #2898
This commit is contained in:
@@ -28,6 +28,15 @@ module.exports.addTests = function({testRunner, expect, DeviceDescriptors}) {
|
||||
await page.click('button');
|
||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||
});
|
||||
it('should click with disabled javascript', async({page, server}) => {
|
||||
await page.setJavaScriptEnabled(false);
|
||||
await page.goto(server.PREFIX + '/wrappedlink.html');
|
||||
await Promise.all([
|
||||
page.click('a'),
|
||||
page.waitForNavigation()
|
||||
]);
|
||||
expect(page.url()).toBe(server.PREFIX + '/wrappedlink.html#clicked');
|
||||
});
|
||||
|
||||
it('should click offscreen buttons', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||
|
||||
Reference in New Issue
Block a user