fix: frameElement should work for framesets (#11842)

This commit is contained in:
Alex Rudenko 2024-02-06 13:13:06 +01:00 committed by GitHub
parent 9add4b4815
commit c5cee0e37d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 4 deletions

View File

@ -425,12 +425,12 @@ export abstract class Frame extends EventEmitter<FrameEvents> {
return null; return null;
} }
using list = await parentFrame.isolatedRealm().evaluateHandle(() => { using list = await parentFrame.isolatedRealm().evaluateHandle(() => {
return document.querySelectorAll('iframe'); return document.querySelectorAll('iframe,frame');
}); });
for await (using iframe of transposeIterableHandle(list)) { for await (using iframe of transposeIterableHandle(list)) {
const frame = await iframe.contentFrame(); const frame = await iframe.contentFrame();
if (frame._id === this._id) { if (frame?._id === this._id) {
return iframe.move(); return (iframe as HandleFor<HTMLIFrameElement>).move();
} }
} }
return null; return null;

View File

@ -647,6 +647,13 @@
"parameters": ["firefox"], "parameters": ["firefox"],
"expectations": ["SKIP"] "expectations": ["SKIP"]
}, },
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should click elements in a frameset",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "New test for framesets. We probably do not want to support framesets in WebDriver BiDi in the long term."
},
{ {
"testIdPattern": "[frame.spec] Frame specs Frame Management should handle nested frames", "testIdPattern": "[frame.spec] Frame specs Frame Management should handle nested frames",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -2195,6 +2202,13 @@
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"] "expectations": ["SKIP"]
}, },
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should click elements in a frameset",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"],
"comment": "New test for framesets (does not seem to pass in Firefox CDP)."
},
{ {
"testIdPattern": "[frame.spec] Frame specs Frame Management should detach child frames on navigation", "testIdPattern": "[frame.spec] Frame specs Frame Management should detach child frames on navigation",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -3550,7 +3564,8 @@
"testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state", "testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"], "parameters": ["chrome", "webDriverBiDi"],
"expectations": ["FAIL"] "expectations": ["SKIP"],
"comment": "Failed previously and currently times out"
}, },
{ {
"testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state", "testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state",

View File

@ -205,6 +205,18 @@ describe('Frame specs', function () {
expect(detachedFrames).toHaveLength(4); expect(detachedFrames).toHaveLength(4);
expect(navigatedFrames).toHaveLength(1); expect(navigatedFrames).toHaveLength(1);
}); });
it('should click elements in a frameset', async () => {
const {page, server} = await getTestState();
await page.goto(server.PREFIX + '/frames/frameset.html');
const frame = await page.waitForFrame(frame => {
return frame.url().endsWith('/frames/frame.html');
});
using div = await frame.waitForSelector('div');
expect(div).toBeTruthy();
await div?.click();
});
it('should report frame from-inside shadow DOM', async () => { it('should report frame from-inside shadow DOM', async () => {
const {page, server} = await getTestState(); const {page, server} = await getTestState();