Last active
September 11, 2020 11:55
-
-
Save supermarsx/91689a8c7637288dd03364443758eed8 to your computer and use it in GitHub Desktop.
Returns a named iframe handle with puppeteer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
getNamedIframe | |
Returns a named iframe handle with puppeteer | |
parameters | |
page (object) - Puppeteer page object | |
iframeName (string) - iframe name | |
*/ | |
async function getNamedIframe(page, iframeName) { | |
iframeName = iframeName || 'main'; | |
// Identify frame | |
console.log(`Getting a named iframe with name "${iframeName}" > (frame)`); | |
return await page.frames().find(f => f.name() === iframeName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment