From 1119f2f5b50a3e8ae77c0baf93490329ed678ef9 Mon Sep 17 00:00:00 2001 From: "maggie.wang" Date: Mon, 31 Mar 2025 14:05:54 +0800 Subject: [PATCH] fix: https://github.com/unclecode/crawl4ai/issues/911 --- crawl4ai/async_crawler_strategy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crawl4ai/async_crawler_strategy.py b/crawl4ai/async_crawler_strategy.py index ddd6348e..7eef0196 100644 --- a/crawl4ai/async_crawler_strategy.py +++ b/crawl4ai/async_crawler_strategy.py @@ -820,7 +820,11 @@ class AsyncPlaywrightCrawlerStrategy(AsyncCrawlerStrategy): for selector in selectors: try: - content = await page.evaluate(f"document.querySelector('{selector}')?.outerHTML || ''") + content = await page.evaluate( + f"""Array.from(document.querySelectorAll("{selector}")) + .map(el => el.outerHTML) + .join('')""" + ) html_parts.append(content) except Error as e: print(f"Warning: Could not get content for selector '{selector}': {str(e)}")