mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix: make contentFrame cross-frame handles test pass (#761)
This commit is contained in:
parent
eb568046eb
commit
603b9f54dd
@ -154,7 +154,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
|
||||
}
|
||||
|
||||
async contentFrame(): Promise<frames.Frame | null> {
|
||||
const isFrameElement = await this._evaluateInUtility(node => node && (node instanceof HTMLIFrameElement || node instanceof HTMLFrameElement));
|
||||
const isFrameElement = await this._evaluateInUtility(node => node && (node.nodeName === 'IFRAME' || node.nodeName === 'FRAME'));
|
||||
if (!isFrameElement)
|
||||
return null;
|
||||
return this._page._delegate.getContentFrame(this);
|
||||
|
@ -381,5 +381,14 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
|
||||
const error = await page.evaluate(body => body.innerHTML, bodyHandle).catch(e => e);
|
||||
expect(error.message).toContain('Unable to adopt element handle from a different document');
|
||||
});
|
||||
it.skip(FFOX)('should return non-empty Node.constructor.name in utility context', async({page,server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||
const frame = page.frames()[1];
|
||||
const context = await frame._utilityContext();
|
||||
const elementHandle = await context.evaluateHandle(() => window.top.document.querySelector('#frame1'));
|
||||
const constructorName = await context.evaluate(node => node.constructor.name, elementHandle);
|
||||
expect(constructorName).toBe('HTMLIFrameElement');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user