Why does "View page source" differ from "Inspect" on some websites and how can I download what I see in Inspect?

I am trying to download the webpage but the file differs in what I download, the page source, and the inspection. How can I download what is shown in the Inspection?

1 answer

  • answered 2019-02-10 12:34 Nikos M.

    View page source returns the static html page as sent by the server and loaded by the browser.

    While inspect will show the current state of the DOM and any dynamic elements that might have been added by javascript that runs in the page.

    To download what you see in inspection you will need a headless browser (eg phantom.js) which can run javascript as well instead of simply downloading the static html page and then hook into the headless browser and get the DOM as text.