docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that captures screenshots of web pages in multiple image formats with configurable quality and region settings.
Create a module that provides functionality to capture screenshots of web pages. The module should support:
The implementation should handle basic error cases such as invalid format specifications or quality values out of range.
/**
* Captures a screenshot of a web page
*
* @param {string} url - The URL of the page to capture
* @param {object} options - Screenshot options
* @param {string} options.path - File path where the screenshot should be saved
* @param {string} [options.format='png'] - Image format: 'png', 'jpeg', or 'webp'
* @param {number} [options.quality] - Image quality (0-100) for JPEG/WebP formats
* @param {boolean} [options.fullPage=false] - Capture the full scrollable page
* @param {object} [options.clip] - Capture a specific region
* @param {number} options.clip.x - X coordinate of the region
* @param {number} options.clip.y - Y coordinate of the region
* @param {number} options.clip.width - Width of the region
* @param {number} options.clip.height - Height of the region
* @returns {Promise<void>}
*/
async function captureScreenshot(url, options) {
// IMPLEMENTATION HERE
}
module.exports = {
captureScreenshot
};Provides browser automation and screenshot capabilities.