feat(webkit): implement ElementHandle.contentFrame (#276)

This commit is contained in:
Yury Semikhatsky 2019-12-17 12:21:53 -07:00 committed by GitHub
parent 4bb3c41faa
commit e851a27350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -10,7 +10,7 @@
"playwright": { "playwright": {
"chromium_revision": "724623", "chromium_revision": "724623",
"firefox_revision": "1007", "firefox_revision": "1007",
"webkit_revision": "1042" "webkit_revision": "1043"
}, },
"scripts": { "scripts": {
"unit": "node test/test.js", "unit": "node test/test.js",

View File

@ -384,7 +384,12 @@ export class FrameManager implements PageDelegate {
} }
async getContentFrame(handle: dom.ElementHandle): Promise<frames.Frame | null> { async getContentFrame(handle: dom.ElementHandle): Promise<frames.Frame | null> {
throw new Error('contentFrame() is not implemented'); const nodeInfo = await this._session.send('DOM.describeNode', {
objectId: toRemoteObject(handle).objectId
});
if (!nodeInfo.contentFrameId)
return null;
return this._page._frameManager.frame(nodeInfo.contentFrameId);
} }
isElementHandle(remoteObject: any): boolean { isElementHandle(remoteObject: any): boolean {

View File

@ -67,7 +67,7 @@ module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
}); });
}); });
describe.skip(WEBKIT)('ElementHandle.contentFrame', function() { describe('ElementHandle.contentFrame', function() {
it('should work', async({page,server}) => { it('should work', async({page,server}) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE); await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);