Giter VIP home page Giter VIP logo

Comments (4)

github-actions avatar github-actions commented on May 23, 2024

This issue has an outdated Puppeteer version: 21.10.0. Please verify your issue on the latest 22.7.1 version. Then update the form accordingly.


Analyzer run

from puppeteer.

Lightning00Blade avatar Lightning00Blade commented on May 23, 2024

There is no expectation from Puppeteer here to return the last response URL, we return the one the user tried to navigate to.
You could work around this by:

let lastNavigationRequest;
page.on('request', req =>{
    //...
    if (req.isNavigationRequest() && req.frame() === page.mainFrame()) {
      lastNavigationRequest = req;
    }
    // Prevent the error form throwing
    await page.goto(...).catch(() => {});
    console.log(lastNavigationRequest.url());
})

Currently Puppeteer does not provide a means to get the request from a failed navigation directly from the page.goto() command.

from puppeteer.

kazanemed avatar kazanemed commented on May 23, 2024

@Lightning00Blade Thanks for your reply however I think there was a misunderstood about the nature of the bug i'm referring to.

For the error : Name Not Resolved , i don't want to get rid of it, in fact, i want to know where exactly in URL's chain it happened, which logically MUST be in the last url that appears. But when i catch the error while navigation, it shows that the error of Name Not Resolved has appeared in the url before final destination ( which is wrong )

from puppeteer.

Lightning00Blade avatar Lightning00Blade commented on May 23, 2024

How puppeteer works is that is sends a command and it fails due to request being canceled,
in such cases we don't try to find the HTTP response associated with the error as we get it from the command.
There is a feature request to support getting the last response from the page #11555
But this is already achievable through page.on('request') with example above given.

from puppeteer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.