I'm using Puppeteer with Jest and I'm trying to get the iframe element using this function:
const frame = await page
.frames()
.find(f => f.name() === 'iframe-class');
The problem is: is there a way to get the iframe by his class instead of the name attribute?
I do not have access to this iframe to insert a new attribute, so I need to select by the class.
You can use the contentFrame function.
const elementHandle = await page.$('.iframe-class');
const frame = await elementHandle.contentFrame();