Capturing Screenshots & PDFs
Browser Swarm enables you to capture high-quality screenshots and generate PDFs of web pages during your automated browser sessions. These features are essential for visual testing, documentation, and archiving purposes.
🖼️ Capturing Screenshots
You can capture screenshots using your preferred automation framework. For optimal performance and flexibility, we recommend using the Chrome DevTools Protocol (CDP).
Example with Playwright
📝 Generating PDFs
Generating PDFs of web pages is straightforward with Browser Swarm. This is particularly useful for saving receipts, reports, or any page content in a portable format.
Example with Playwright
💡 Best Practices
Use CDP for Performance: Leveraging the Chrome DevTools Protocol can result in faster and more reliable screenshot captures.
Full-Page Screenshots: Set
fullPage: true
to capture the entire scrollable area of the page.PDF Formatting: Adjust the
format
parameter (e.g., 'A4', 'Letter') and setprintBackground: true
to include background graphics in PDFs.Error Handling: Implement appropriate error handling to manage scenarios where page loading or rendering might fail.
By integrating these capabilities into your automation workflows, Browser Swarm enhances your ability to document and analyze web content effectively.
Last updated