diff --git a/crawl4ai/async_crawler_strategy.py b/crawl4ai/async_crawler_strategy.py index 987925f8..c5833eff 100644 --- a/crawl4ai/async_crawler_strategy.py +++ b/crawl4ai/async_crawler_strategy.py @@ -312,7 +312,12 @@ async def crawl(self, url: str, **kwargs) -> AsyncCrawlResponse: "status_code": status_code }, f) - response = AsyncCrawlResponse(html=html, response_headers=response_headers, status_code=status_code) + if kwargs.get("screenshot", False): + screenshot_data = await self.take_screenshot(url) + + response = AsyncCrawlResponse( + html=html, response_headers=response_headers, status_code=status_code, screenshot=screenshot_data + ) return response except Error as e: raise Error(f"Failed to crawl {url}: {str(e)}")