From e851a273506b677f23a06fba77a866c8c8b474f7 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 17 Dec 2019 12:21:53 -0700 Subject: [PATCH] feat(webkit): implement ElementHandle.contentFrame (#276) --- package.json | 2 +- src/webkit/FrameManager.ts | 7 ++++++- test/elementhandle.spec.js | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index edd62eb04c..8ea026706c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "playwright": { "chromium_revision": "724623", "firefox_revision": "1007", - "webkit_revision": "1042" + "webkit_revision": "1043" }, "scripts": { "unit": "node test/test.js", diff --git a/src/webkit/FrameManager.ts b/src/webkit/FrameManager.ts index dbccef357b..74d5d661c8 100644 --- a/src/webkit/FrameManager.ts +++ b/src/webkit/FrameManager.ts @@ -384,7 +384,12 @@ export class FrameManager implements PageDelegate { } async getContentFrame(handle: dom.ElementHandle): Promise { - 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 { diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.js index 97d83a1c3e..eb62711245 100644 --- a/test/elementhandle.spec.js +++ b/test/elementhandle.spec.js @@ -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}) => { await page.goto(server.EMPTY_PAGE); await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);