crawl4ai
crawl4ai copied to clipboard
Missing implementation for `crawl4ai.async_crawler_strategy.AsyncPlaywrightCrawlerStrategy._generate_screenshot_from_html()`
https://github.com/unclecode/crawl4ai/blob/0024c82cdcbd7c2d9e9e93ec40c8fec2563eff8f/crawl4ai/async_crawler_strategy.py#L491C46-L491C76
Is there any implementation for the _generate_screenshot_from_html() method under the AsyncPlaywrightCrawlerStrategy class in crawl4ai/async_crawler_strategy.py? I ran into an error when I'd set up this CrawlerRunConfig -
run_config = CrawlerRunConfig(
cache_mode=CacheMode.BYPASS,
markdown_generator=DefaultMarkdownGenerator(
content_filter=PruningContentFilter()
),
wait_for_images=True,
scan_full_page=True,
scroll_delay=0.5,
verbose=True,
pdf=True,
screenshot=True
)
which led to this error -
[ERROR]... × file:///home/arjun/repo...ingOnTheCompressor.html | Error: Unexpected error in _crawl_web at line 466 in crawl
(.venv/lib/python3.13/site-packages/crawl4ai/async_crawler_strategy.py):
Error: 'AsyncPlaywrightCrawlerStrategy' object has no attribute '_generate_screenshot_from_html'
Code context:
461 if not os.path.exists(local_file_path):
462 raise FileNotFoundError(f"Local file not found: {local_file_path}")
463 with open(local_file_path, "r", encoding="utf-8") as f:
464 html = f.read()
465 if config.screenshot:
466 → screenshot_data = await self._generate_screenshot_from_html(html)
467 if config.capture_console_messages:
468 page, context = await self.browser_manager.get_page(crawlerRunConfig=config)
469 captured_console = await self._capture_console_messages(page, url)
470
471 return AsyncCrawlResponse(
Extraction failed: Failed to process HTML file: Unexpected error in _crawl_web at line 466 in crawl (.venv/lib/python3.13/site-packages/crawl4ai/async_crawler_strategy.py):
Error: 'AsyncPlaywrightCrawlerStrategy' object has no attribute '_generate_screenshot_from_html'
Code context:
461 if not os.path.exists(local_file_path):
462 raise FileNotFoundError(f"Local file not found: {local_file_path}")
463 with open(local_file_path, "r", encoding="utf-8") as f:
464 html = f.read()
465 if config.screenshot:
466 → screenshot_data = await self._generate_screenshot_from_html(html)
467 if config.capture_console_messages:
468 page, context = await self.browser_manager.get_page(crawlerRunConfig=config)
469 captured_console = await self._capture_console_messages(page, url)
470
471 return AsyncCrawlResponse(