mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(page.click): teach puppeteer click wrapped links (#2822)
This patch teaches Puppeteer to click elements that are part of inline layout and that wrap on multiple lines. Fixes #2798.
This commit is contained in:
29
test/assets/wrappedlink.html
Normal file
29
test/assets/wrappedlink.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<style>
|
||||
:root {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 10ch;
|
||||
word-wrap: break-word;
|
||||
border: 1px solid blue;
|
||||
transform: rotate(33deg);
|
||||
line-height: 8ch;
|
||||
padding: 2ch;
|
||||
}
|
||||
|
||||
a {
|
||||
margin-left: 7ch;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<a href='#clicked'>123321</a>
|
||||
</div>
|
||||
<script>
|
||||
</script>
|
||||
@@ -52,6 +52,15 @@ module.exports.addTests = function({testRunner, expect, DeviceDescriptors}) {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should click wrapped links', async({page, server}) => {
|
||||
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 on checkbox input and toggle', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/checkbox.html');
|
||||
expect(await page.evaluate(() => result.check)).toBe(null);
|
||||
|
||||
Reference in New Issue
Block a user