I want to make a screenshot of a page with Chrome Headless, and we've seen both the
--screenshot and the
--virtual-time-budget switches for taking a screenshot and limiting the browser's waiting for load time.
I have elements on the page however that wait for DOMContentLoaded to render, and we want to capture those too.
I'm looking for a way to take a screenshot, say, 5 seconds after the page is loaded, instead of right when it's considered loaded.
We're calling Chrome Headless from our NodeJS application like so:
cp.spawnSync("google-chrome-beta", ["--headless", "--disable-gpu", "--screenshot", "--profile-directory=Default", "--window-size=1920,6200", "--virtual-time-budget=25000", url]);
We know that there are possible npm libraries that can achieve this using an API from node, instead of using command line switches, but we're concerned about stability (the Chrome team likes to break all their internal APIs regularly).
Is there anyway to make Chrome Headless wait a few seconds after page load before taking a screenshot?