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

185
Visualizações
Login > Go to Specific Page > Search > Grab Specific Content From Page Using Node JS and Puppeteer

I want to scrape some data from login protected page using Node Js and Puppeteer. When I try to scrape data, the shows page is not reachable. I don't have any idea about why I am getting output like this. Here is my code.

I am new to Puppeteer and Node Js, its been 8 hours I am trying to modify that code, but not working.

async function EmailLookup(MlsNumber)
{
    resp = new { Success = false };

     (page = await singletonBrowser.Instance.newPage())
    {
        await page.setRequestInterception(true);

         page.Request += (sender, e) =>
         {
            if (e.Request.resourceType === resourceType.document || e.Request.resourceType === resourceType.Script || e.Request.resourceType === resourceType.Xhr)
                e.Request.Continue();
             else
                 e.Request.Abort();
         };

        await page.async("https://example.com/idp/login");

        if (!page.Url.Contains("layouts"))
        {
            await page.waitForSelector("#username");

            await page.waitForSelector("#password");

            await page.waitForSelector("#loginbtn");

            await page.async("#username", "xxxxx");

            await page.async("#password", "xxxxx");

            await page.async("#password", "\r");

            await page.waitForNavigation(new navigationOptions { Timeout = 0 });
        }

        await page.goto("https://example.com/launch?layoutid=61&appid=433");

        await page.waitForSelector("#ctl02_m_ucSpeedBar_m_tbSpeedBar");

        await page.async("#ctl02_m_ucSpeedBar_m_tbSpeedBar", MlsNumber);

        await page.async("#ctl02_m_ucSpeedBar_m_tbSpeedBar", "\r");

        await page.waitForNavigation(new navigationOptions { Timeout = 0 });

        var MLSLink = await page.waitForXPath("//a[text()='" + MlsNumber + "']");

        if (MLSLink != null)
        {
            await MLSLink.click();
            await page.waitForNavigation(new navigationOptions{ Timeout = 0 });
            var Content = await page.get();

            htmldoc = new htmldoc();
            htmldoc.load(Content);

            var parcelNode = htmldoc.document.selectSingleNode("//a[contains(@href,'AssessorParcelDetail')]");
            var emailNode = htmldoc.document.selectSingleNode("//a[contains(@href,'mailto:')]");

            if (emailNode != null && parcelNode != null)
            {
                resp.Success = true;
                resp.Email = emailNode.innerText;
                resp.Parcel = parcelNode.innerText;
            }
        }

        return json(resp);
    }
}
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