puppeteer : wait for ajax call after navigation [duplicate]












0
















This question already has an answer here:




  • how to handle elements that load after ajax request in puppeteer

    1 answer




so in my code i submit a form , wait for navigation and submit a second form ... here is the tricky part ... before the second from submit some data will be loaded in the from with ajax



i want to wait for those ajax call the be done and then submit the second form



here is a simplified version of my code



    await Promise.all([
page.click('#form1_submit'),
page.waitForNavigation(),
])


if (!await page.$("#form2_element"))
throw new Error(' ELEMENT MISSING 2 ');

await page.$eval('#form2_element', (el, data) => el.value = data.value , data);



await Promise.all([
page.click('#form2_submit'),
page.waitForNavigation(),
])


after this



 await Promise.all([
page.click('#form1_submit'),
page.waitForNavigation(),
])


how can i say wait for ajax calls ? i tried this



    await Promise.all([
page.click('#form1_submit'),
page.waitForNavigation({ waitUntil: "networkidle0" }),
])


but it didnt work and for submited before ajax call is done










share|improve this question













marked as duplicate by Louis javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 22 '18 at 23:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • how to handle elements that load after ajax request in puppeteer

      1 answer




    so in my code i submit a form , wait for navigation and submit a second form ... here is the tricky part ... before the second from submit some data will be loaded in the from with ajax



    i want to wait for those ajax call the be done and then submit the second form



    here is a simplified version of my code



        await Promise.all([
    page.click('#form1_submit'),
    page.waitForNavigation(),
    ])


    if (!await page.$("#form2_element"))
    throw new Error(' ELEMENT MISSING 2 ');

    await page.$eval('#form2_element', (el, data) => el.value = data.value , data);



    await Promise.all([
    page.click('#form2_submit'),
    page.waitForNavigation(),
    ])


    after this



     await Promise.all([
    page.click('#form1_submit'),
    page.waitForNavigation(),
    ])


    how can i say wait for ajax calls ? i tried this



        await Promise.all([
    page.click('#form1_submit'),
    page.waitForNavigation({ waitUntil: "networkidle0" }),
    ])


    but it didnt work and for submited before ajax call is done










    share|improve this question













    marked as duplicate by Louis javascript
    Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Dec 22 '18 at 23:31


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • how to handle elements that load after ajax request in puppeteer

        1 answer




      so in my code i submit a form , wait for navigation and submit a second form ... here is the tricky part ... before the second from submit some data will be loaded in the from with ajax



      i want to wait for those ajax call the be done and then submit the second form



      here is a simplified version of my code



          await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation(),
      ])


      if (!await page.$("#form2_element"))
      throw new Error(' ELEMENT MISSING 2 ');

      await page.$eval('#form2_element', (el, data) => el.value = data.value , data);



      await Promise.all([
      page.click('#form2_submit'),
      page.waitForNavigation(),
      ])


      after this



       await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation(),
      ])


      how can i say wait for ajax calls ? i tried this



          await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation({ waitUntil: "networkidle0" }),
      ])


      but it didnt work and for submited before ajax call is done










      share|improve this question















      This question already has an answer here:




      • how to handle elements that load after ajax request in puppeteer

        1 answer




      so in my code i submit a form , wait for navigation and submit a second form ... here is the tricky part ... before the second from submit some data will be loaded in the from with ajax



      i want to wait for those ajax call the be done and then submit the second form



      here is a simplified version of my code



          await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation(),
      ])


      if (!await page.$("#form2_element"))
      throw new Error(' ELEMENT MISSING 2 ');

      await page.$eval('#form2_element', (el, data) => el.value = data.value , data);



      await Promise.all([
      page.click('#form2_submit'),
      page.waitForNavigation(),
      ])


      after this



       await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation(),
      ])


      how can i say wait for ajax calls ? i tried this



          await Promise.all([
      page.click('#form1_submit'),
      page.waitForNavigation({ waitUntil: "networkidle0" }),
      ])


      but it didnt work and for submited before ajax call is done





      This question already has an answer here:




      • how to handle elements that load after ajax request in puppeteer

        1 answer








      javascript node.js puppeteer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 15:00









      hretichretic

      338623




      338623




      marked as duplicate by Louis javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Dec 22 '18 at 23:31


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Louis javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Dec 22 '18 at 23:31


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          If you want to wait for data to be displayed after an AJAX call is made, I'll point you towards my answer on this very topic from another thread:



          how to handle elements that load after ajax request in puppeteer



          Hopefully this helps!






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            If you want to wait for data to be displayed after an AJAX call is made, I'll point you towards my answer on this very topic from another thread:



            how to handle elements that load after ajax request in puppeteer



            Hopefully this helps!






            share|improve this answer




























              0














              If you want to wait for data to be displayed after an AJAX call is made, I'll point you towards my answer on this very topic from another thread:



              how to handle elements that load after ajax request in puppeteer



              Hopefully this helps!






              share|improve this answer


























                0












                0








                0







                If you want to wait for data to be displayed after an AJAX call is made, I'll point you towards my answer on this very topic from another thread:



                how to handle elements that load after ajax request in puppeteer



                Hopefully this helps!






                share|improve this answer













                If you want to wait for data to be displayed after an AJAX call is made, I'll point you towards my answer on this very topic from another thread:



                how to handle elements that load after ajax request in puppeteer



                Hopefully this helps!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 17:09









                AJC24AJC24

                1,1932716




                1,1932716















                    Popular posts from this blog

                    Full-time equivalent

                    さくらももこ

                    13 indicted, 8 arrested in Calif. drug cartel investigation