Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Cookies block other content

magmuellerd41657f26af0
diff --git a/src/state_manager/utils.py b/src/state_manager/utils.py
index ca0468b7a..01ea06dda 100644
--- a/src/state_manager/utils.py
+++ b/src/state_manager/utils.py
@@ -112,3 +112,8 @@ def save_formatted_html(html_content, output_file_name):
# Save formatted HTML to file
with open("temp/"+output_file_name, 'w', encoding='utf-8') as f:
f.write(formatted_html)
+
+
+def save_markdown(markdown_content, output_file_name):
+ with open("temp/"+output_file_name, 'w', encoding='utf-8') as f:
+ f.write(markdown_content)
diff --git a/src/tests/test_kayak_search.py b/src/tests/test_kayak_search.py
index cbb05d6ce..e9919b8fe 100644
--- a/src/tests/test_kayak_search.py
+++ b/src/tests/test_kayak_search.py
@@ -1,8 +1,9 @@
import unittest
+import time
from src.utils.selenium_utils import setup_selenium_driver
from src.actions.browser_actions import BrowserActions
from src.state_manager.state import StateManager
-from src.state_manager.utils import save_formatted_html
+from src.state_manager.utils import save_formatted_html, save_markdown
from src.agent_interface.planing_agent import PlaningAgent
@@ -30,6 +31,7 @@ class TestKayakSearch(unittest.TestCase):
# Get current state
current_state = self.state_manager.get_current_state()
save_formatted_html(current_state["interactable_elements"], f"current_state_{i}.html")
+ save_markdown(current_state["main_content"], f"current_state_{i}.md")
# Get next action from agent
text = f"Current state: {current_state}"
print(f"\n{text}\n")
@@ -42,6 +44,11 @@ class TestKayakSearch(unittest.TestCase):
print("Task completed")
break
+ # wait for 1 second
+ # time.sleep(4)
+ # wait until i hit enter in the console
+ input("\n\n\nPress Enter to continue...")
+
else:
self.fail("Failed to complete flight search task in maximum steps")