Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
Puppeteer - Accessing an IFrame within an IFrame

I am having an issue retrieving an IFrame within an IFrame I am not exactly sure how to get the result that I am looking for, I am able to retrieve the Parent IFrame just fine, however when trying to choose the child it does not find the selector of the click method. How would I go about solving this? I am quite new to Puppeteer

 // Get Email
await click(contentBuilderFrame, getEmail)
await page.waitFor(200);

await click(contentBuilderFrame, '#index-entry > div > div > div.active > div > div > div.contentproperties-header > div.contentproperties-buttons > div > div > div > a');
await page.waitFor(200);

const container = await findFrame(page, "EmailAppContainer");
await page.waitFor(200);

// Will not find it
const child = await findFrame(container, "cloud/tools/SSO.aspx?legacy=1&env=default&appId=6DF293A1-4FDC-41CD-AA08-89EFC793C33C&deepLink=%2f%23%2femails");

// Timeout because cant find selector due to not finding frame
await click(child, '#sendflow-step-content')

findFrame Method:

async function findFrame(page, urlPart) {
const mainFrame = page.mainFrame();

const contentFrames = await getContentFrames(mainFrame);
let frame = null;

for (const contentFrame of contentFrames) {
    if (contentFrame.url().includes(urlPart)) {
        frame = contentFrame;
    }
}
return frame;
}

getContentFrames:

async function getContentFrames(frame) {
const contentFrames = [];
const iframes = await frame.$$("iframe");

for (const iframe of iframes) {
    const contentFrame = await iframe.contentFrame();

    if (contentFrame != null) {
        contentFrames.push(contentFrame);
        let subContentFrames = await getContentFrames(contentFrame);

        if (subContentFrames.length > 0) {
            contentFrames.push(...subContentFrames);
        }
    }
}
//console.log(contentFrames);
return contentFrames;
}

My understanding here is that I get all the frames with the getContentFrames method - I made sure that is the case by logging the output for these, but unsure how to proceed from there on out?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda