Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

new file: tests/metagpt/tools/libs/test_web_scraping.py

刘棒棒3f2b512d297e
diff --git a/tests/metagpt/tools/libs/test_web_scraping.py b/tests/metagpt/tools/libs/test_web_scraping.py
new file mode 100644
index 000000000..c11960e68
--- /dev/null
+++ b/tests/metagpt/tools/libs/test_web_scraping.py
@@ -0,0 +1,23 @@
+import pytest
+
+from metagpt.tools.libs.web_scraping import scrape_web_playwright
+
+
+async def test_scrape_web_playwright():
+ test_url = "https://www.deepwisdom.ai"
+
+ result = await scrape_web_playwright(test_url)
+
+ # Assert that the result is a dictionary
+ assert isinstance(result, dict)
+
+ # Assert that the result contains 'inner_text' and 'html' keys
+ assert "inner_text" in result
+ assert "html" in result
+
+ # Assert startswith and endswith
+ assert not result["inner_text"].startswith(" ")
+ assert not result["inner_text"].endswith(" ")
+ assert not result["html"].startswith(" ")
+ assert not result["html"].endswith(" ")