Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda