Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

Fixing a bug with reading response bytes in playwright/camoufox when `network_idle` is used

Karim shoair4c74d9bc972c
diff --git a/scrapling/engines/camo.py b/scrapling/engines/camo.py
index 62fdd39..2f8a1f9 100644
--- a/scrapling/engines/camo.py
+++ b/scrapling/engines/camo.py
@@ -114,7 +114,7 @@ class CamoufoxEngine:
response = Response(
url=res.url,
text=page.content(),
- body=res.body(),
+ body=page.content().encode('utf-8'),
status=res.status,
reason=res.status_text,
encoding=encoding,
diff --git a/scrapling/engines/pw.py b/scrapling/engines/pw.py
index 3395ece..c83bfe3 100644
--- a/scrapling/engines/pw.py
+++ b/scrapling/engines/pw.py
@@ -224,7 +224,7 @@ class PlaywrightEngine:
response = Response(
url=res.url,
text=page.content(),
- body=res.body(),
+ body=page.content().encode('utf-8'),
status=res.status,
reason=res.status_text,
encoding=encoding,