diff options
Diffstat (limited to '')
-rw-r--r-- | remote/test/puppeteer/test/src/utils.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/remote/test/puppeteer/test/src/utils.ts b/remote/test/puppeteer/test/src/utils.ts index d1bad65a16..d0dc08c33b 100644 --- a/remote/test/puppeteer/test/src/utils.ts +++ b/remote/test/puppeteer/test/src/utils.ts @@ -112,15 +112,24 @@ export async function navigateFrame( } } -export const dumpFrames = (frame: Frame, indentation?: string): string[] => { +export const dumpFrames = async ( + frame: Frame, + indentation?: string +): Promise<string[]> => { indentation = indentation || ''; let description = frame.url().replace(/:\d{4,5}\//, ':<PORT>/'); - if (frame.name()) { - description += ' (' + frame.name() + ')'; + using element = await frame.frameElement(); + if (element) { + const nameOrId = await element.evaluate(frame => { + return frame.name || frame.id; + }); + if (nameOrId) { + description += ' (' + nameOrId + ')'; + } } const result = [indentation + description]; for (const child of frame.childFrames()) { - result.push(...dumpFrames(child, ' ' + indentation)); + result.push(...(await dumpFrames(child, ' ' + indentation))); } return result; }; |