mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(dom): click on links inside shadow dom (#5850)
This commit is contained in:
parent
1444cc873a
commit
4f2827f302
@ -645,7 +645,10 @@ export class InjectedScript {
|
||||
let container: Document | ShadowRoot | null = document;
|
||||
let element: Element | undefined;
|
||||
while (container) {
|
||||
const innerElement = container.elementFromPoint(x, y) as Element | undefined;
|
||||
// elementFromPoint works incorrectly in Chromium (http://crbug.com/1188919),
|
||||
// so we use elementsFromPoint instead.
|
||||
const elements = container.elementsFromPoint(x, y);
|
||||
const innerElement = elements[0] as Element | undefined;
|
||||
if (!innerElement || element === innerElement)
|
||||
break;
|
||||
element = innerElement;
|
||||
|
@ -27,8 +27,8 @@ it('should work for open shadow roots', async ({page, server}) => {
|
||||
expect(await page.$$(`data-testid:light=foo`)).toEqual([]);
|
||||
});
|
||||
|
||||
it('should click on links in shadow dom', (test, { browserName }) => {
|
||||
test.fixme(browserName === 'chromium', 'Cannot get link quads, see #5765');
|
||||
it('should click on links in shadow dom', (test, { browserName, browserChannel }) => {
|
||||
test.fixme(browserName === 'chromium' && !!browserChannel, 'Enable when crrev.com/864024 get to the stable channel');
|
||||
}, async ({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/shadow-dom-link.html');
|
||||
expect(await page.evaluate(() => (window as any).clickCount)).toBe(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user