Capture screenshots¶
Goal: capture a PNG of a rendered page, optionally faster by blocking heavy resources.
Screenshots require a browser tier (standard or stealth). Enable include_screenshot in artifact_options.
Minimal example¶
Download the image¶
job = client.jobs.get(result.job_id)
shot = next(a for a in job.artifacts if a.artifact_type == "screenshot")
with open("page.png", "wb") as f:
f.write(client.artifacts.download_bytes(shot.artifact_id))
Variations¶
Faster, cheaper captures — block resources you don't need in the image. Blocking images/fonts/media can cut load time dramatically:
client.scrape_sync(
job_type="standard",
target_url="https://example.com",
artifact_options={
"include_screenshot": True,
"block_media": True,
"block_fonts": True,
},
)
Control the frame — set a viewport for consistent dimensions (e.g. mobile vs desktop):
client.scrape_sync(
job_type="standard",
target_url="https://example.com",
viewport={"width": 390, "height": 844}, # mobile
artifact_options={"include_screenshot": True},
)
Wait for content — for slow pages, wait until the network is idle before capturing:
client.scrape_sync(
job_type="standard",
target_url="https://example.com/app",
wait_until="networkidle",
artifact_options={"include_screenshot": True},
)
Disable auto-scroll — by default we scroll the page to trigger lazy-loaded content before capture. Set no_scroll to capture the initial viewport only:
See also¶
- Job Parameters → Artifact options — every capture flag.
- Scrape a JavaScript SPA — waiting and interacting before capture.
- Worker Tiers — Standard vs Stealth.