'How to fetch dynamically rendered HTML from a SPA
Context
I'm trying to use the javascript fetch command to return the HTML of a leetcode.com webpage, but when I do the returned HTML is in a pre-rendered state i.e. the div of interest is empty:
<div id="app"></div>
When I load the page of interest with my browser and inspect element however, I can see that this "app" div gets populated with dynamic content as leetcode uses single-page-application technology. This rendering must be happening after the fetch command executes.
Question
I would like to know how to use the fetch command or similar in order to retrieve the html of a fully rendered webpage. I would like to do this to scrape some content which only appears after the webpage has been fully rendered.
Assumptions
I'm assuming that the fetch command cannot return html that gets rendered by javascript, i.e. similar to what you'll find with vue.js or react.js
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
