Can we fetch HTTP return code of previous call?How does Chrome find the function call stack, can I call it directly in puppeteer?How can I call a function of an element returned as an ElementHandle?Puppeteer when error go to previous function or callPuppeteer authentication does not work in headless mode but yes in non headless modepuppeteer header and footertemplate doesnt workContent from puppeteer script not being fetched in ubunutuUsing Puppeteer, how can I open a page, get the data, then go back to the previous page to get the next page on the list?Log `console` calls made in client-side code from the Puppeteer Node.js processHow can I fetch an url using session data from puppeteer page?For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves puppeteer and mocha

Why would the US President need briefings on UFOs?

Do ability scores have any effect on casting Wish spell

Was this pillow joke on Friends intentional or a mistake?

Can I switch to third-person while not in 'town' in Destiny 2?

Is it safe to remove the bottom chords of a series of garage roof trusses?

Justifying the use of directed energy weapons

Why were movies shot on film shot at 24 frames per second?

Why does my house heat up, even when it's cool outside?

How to refer to a regex group in awk regex?

Can a character spend multiple hit dice at level 1?

System to validate run time complexity requirements

What is the hex versus octal timeline?

Create Tmux pane with sudo from sudoed pane?

Were there 486SX revisions without an FPU on the die?

How to write triplets in 4/4 time without using a 3 on top of the notes all the time

Does an object count as "being moved" when placed in a Bag of Holding before its wielder moves, and then after moving they take the object out again?

Are there nouns that change meaning based on gender?

map 5 unequal ranges to id

If all stars rotate, why was there a theory developed, that requires non-rotating stars?

Why aren't RCS openings an issue for spacecraft heat shields?

Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?

Three Singles in Three Clubs

Why don't we use Cavea-B

Why did this happen to Thanos's ships at the end of "Avengers: Endgame"?



Can we fetch HTTP return code of previous call?


How does Chrome find the function call stack, can I call it directly in puppeteer?How can I call a function of an element returned as an ElementHandle?Puppeteer when error go to previous function or callPuppeteer authentication does not work in headless mode but yes in non headless modepuppeteer header and footertemplate doesnt workContent from puppeteer script not being fetched in ubunutuUsing Puppeteer, how can I open a page, get the data, then go back to the previous page to get the next page on the list?Log `console` calls made in client-side code from the Puppeteer Node.js processHow can I fetch an url using session data from puppeteer page?For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves puppeteer and mocha






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I search doc and the web, but can't find how to get the HTTP code of a query.



Anyone knows ?



Example :



const puppeteer = require('puppeteer');
const fs = require('fs');
const debug = true;

var base_url = 'https://stackoverflow.com/';

(async () =>
const browser = await puppeteer.launch(
headless: true,
);

const page = await browser.newPage();
await page.goto('https://stackoverflow.com');

// how to get HTTP code of last call ?

await browser.close();

)();


There's response.status() but don't know how to just fetch last query and not all with



page.on('response', response => 
console.log("response code: ", response.status());
);









share|improve this question


























  • Can you share some piece of code?

    – hardkoded
    Mar 27 at 15:47











  • As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

    – Take_Care_
    Mar 27 at 16:30












  • Thanks, explaned in my response

    – Gilles Quenot
    Mar 27 at 16:34

















1















I search doc and the web, but can't find how to get the HTTP code of a query.



Anyone knows ?



Example :



const puppeteer = require('puppeteer');
const fs = require('fs');
const debug = true;

var base_url = 'https://stackoverflow.com/';

(async () =>
const browser = await puppeteer.launch(
headless: true,
);

const page = await browser.newPage();
await page.goto('https://stackoverflow.com');

// how to get HTTP code of last call ?

await browser.close();

)();


There's response.status() but don't know how to just fetch last query and not all with



page.on('response', response => 
console.log("response code: ", response.status());
);









share|improve this question


























  • Can you share some piece of code?

    – hardkoded
    Mar 27 at 15:47











  • As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

    – Take_Care_
    Mar 27 at 16:30












  • Thanks, explaned in my response

    – Gilles Quenot
    Mar 27 at 16:34













1












1








1








I search doc and the web, but can't find how to get the HTTP code of a query.



Anyone knows ?



Example :



const puppeteer = require('puppeteer');
const fs = require('fs');
const debug = true;

var base_url = 'https://stackoverflow.com/';

(async () =>
const browser = await puppeteer.launch(
headless: true,
);

const page = await browser.newPage();
await page.goto('https://stackoverflow.com');

// how to get HTTP code of last call ?

await browser.close();

)();


There's response.status() but don't know how to just fetch last query and not all with



page.on('response', response => 
console.log("response code: ", response.status());
);









share|improve this question
















I search doc and the web, but can't find how to get the HTTP code of a query.



Anyone knows ?



Example :



const puppeteer = require('puppeteer');
const fs = require('fs');
const debug = true;

var base_url = 'https://stackoverflow.com/';

(async () =>
const browser = await puppeteer.launch(
headless: true,
);

const page = await browser.newPage();
await page.goto('https://stackoverflow.com');

// how to get HTTP code of last call ?

await browser.close();

)();


There's response.status() but don't know how to just fetch last query and not all with



page.on('response', response => 
console.log("response code: ", response.status());
);






puppeteer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:22







Gilles Quenot

















asked Mar 27 at 15:44









Gilles QuenotGilles Quenot

114k23 gold badges171 silver badges174 bronze badges




114k23 gold badges171 silver badges174 bronze badges















  • Can you share some piece of code?

    – hardkoded
    Mar 27 at 15:47











  • As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

    – Take_Care_
    Mar 27 at 16:30












  • Thanks, explaned in my response

    – Gilles Quenot
    Mar 27 at 16:34

















  • Can you share some piece of code?

    – hardkoded
    Mar 27 at 15:47











  • As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

    – Take_Care_
    Mar 27 at 16:30












  • Thanks, explaned in my response

    – Gilles Quenot
    Mar 27 at 16:34
















Can you share some piece of code?

– hardkoded
Mar 27 at 15:47





Can you share some piece of code?

– hardkoded
Mar 27 at 15:47













As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

– Take_Care_
Mar 27 at 16:30






As I see in docs page.goto('https://stackoverflow.com') returns Promise<Response> so just pass to the promise then method the callback function which will revice Response. But using await before page.goto should resolve the returned object directly to Response object.

– Take_Care_
Mar 27 at 16:30














Thanks, explaned in my response

– Gilles Quenot
Mar 27 at 16:34





Thanks, explaned in my response

– Gilles Quenot
Mar 27 at 16:34












1 Answer
1






active

oldest

votes


















1













OK, get it, thanks @Take_Care:



response.status()



const puppeteer = require('puppeteer');
const fs = require('fs');
const debug = true;

var base_url = 'https://stackoverflow.com/';

(async () =>
const browser = await puppeteer.launch(
headless: true,
);

const page = await browser.newPage();
cons ret = await page.goto('https://stackoverflow.com');

console.log(ret.status());

await browser.close();

)();





share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381264%2fcan-we-fetch-http-return-code-of-previous-call%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1













    OK, get it, thanks @Take_Care:



    response.status()



    const puppeteer = require('puppeteer');
    const fs = require('fs');
    const debug = true;

    var base_url = 'https://stackoverflow.com/';

    (async () =>
    const browser = await puppeteer.launch(
    headless: true,
    );

    const page = await browser.newPage();
    cons ret = await page.goto('https://stackoverflow.com');

    console.log(ret.status());

    await browser.close();

    )();





    share|improve this answer































      1













      OK, get it, thanks @Take_Care:



      response.status()



      const puppeteer = require('puppeteer');
      const fs = require('fs');
      const debug = true;

      var base_url = 'https://stackoverflow.com/';

      (async () =>
      const browser = await puppeteer.launch(
      headless: true,
      );

      const page = await browser.newPage();
      cons ret = await page.goto('https://stackoverflow.com');

      console.log(ret.status());

      await browser.close();

      )();





      share|improve this answer





























        1












        1








        1







        OK, get it, thanks @Take_Care:



        response.status()



        const puppeteer = require('puppeteer');
        const fs = require('fs');
        const debug = true;

        var base_url = 'https://stackoverflow.com/';

        (async () =>
        const browser = await puppeteer.launch(
        headless: true,
        );

        const page = await browser.newPage();
        cons ret = await page.goto('https://stackoverflow.com');

        console.log(ret.status());

        await browser.close();

        )();





        share|improve this answer















        OK, get it, thanks @Take_Care:



        response.status()



        const puppeteer = require('puppeteer');
        const fs = require('fs');
        const debug = true;

        var base_url = 'https://stackoverflow.com/';

        (async () =>
        const browser = await puppeteer.launch(
        headless: true,
        );

        const page = await browser.newPage();
        cons ret = await page.goto('https://stackoverflow.com');

        console.log(ret.status());

        await browser.close();

        )();






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 27 at 16:34

























        answered Mar 27 at 16:14









        Gilles QuenotGilles Quenot

        114k23 gold badges171 silver badges174 bronze badges




        114k23 gold badges171 silver badges174 bronze badges



















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381264%2fcan-we-fetch-http-return-code-of-previous-call%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript