Options
takeScreenshotWhen
Which loading step to wait for before capturing.
- Type
- "load" | "domcontentloaded" | "networkidle" | "commit"
- Default
- "load"
- Group
- Timing
On this page
OverviewLink to this section
Decides which loading step the browser waits for before it carries on. Whatever you pick, the page is then scrolled for lazy content, cleaned of banners and given your script, styles and waitBeforeScreenshot before the shot.
Any value outside the list falls back to load.
ValuesLink to this section
loadDefaultThe load event fired, so the page and its images, styles and scripts are in.domcontentloadedThe HTML is parsed, which is earlier thanloadand does not wait for images.networkidleThere were no network connections for at least 500 milliseconds.commitThe first response arrived and the document started loading. The earliest step.
ExampleLink to this section
The same request with the SDK, with cURL and as the raw JSON body.
screenshot.ts
import { Url2Image } from '@url2image/sdk'
const { success, data, message } = await Url2Image({
url: 'https://example.com',
token: process.env.URL2IMAGE_TOKEN,
options: {
takeScreenshotWhen: 'networkidle'
}
})Good to knowLink to this section
Related optionsLink to this section
waitBeforeScreenshotExtra time to wait before the capture, in milliseconds, up to 60000.allowAnimationsSet it to false to freeze CSS animations and transitions during the capture.
Every option, grouped, is in the options overview.
Something unclear or missing on this page?
Tell us