

Puppeteer is the tool. It takes some getting used to.
You can set a bunch of triggers that determine exactly when the screenshot fires, and you can simulate mouse movement and scrolling to deal with lazy loading.
There’s even time delays that differentiates between human time and machine time, allowing you to have the software act as if it was running for longer than it actually was, which deals with other weirdness seen in web apps.
You can run it inside Docker which might simplify things for you.
I ended up writing a node.js app to control puppeteer precisely how I needed to.
Source: I spent 48 months or so using it for a project that required all of that.

















An extra observation, if you’re doing QA and you’re running out of memory, there is a good chance that the actual users will experience the same issue.
If you’re running this inside Docker, you can specify exactly how much memory it has access to, which can also act as a data point for your QA process.