Skip to content

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

add msg to compat warning about migrating custom actions

Nick Sweetingdda223720e41
diff --git a/browser_use/browser/compat.py b/browser_use/browser/compat.py
index 31a2d9df4..85fc3221b 100644
--- a/browser_use/browser/compat.py
+++ b/browser_use/browser/compat.py
@@ -52,6 +52,13 @@ DEPRECATION_MESSAGE = """
)
agent = Agent(browser_session=browser_session, ...)
...
+
+ # custom actions should be updated to take browser_session instead of browser_context:
+ @controller.registry.action('Custom action to insert some text into a field')
+ def insert_text_into_field(text: str, browser_session: BrowserSession):
+ page = await browser_session.get_current_page()
+ await page.keyboard.type(text)
+ return ActionResult(result=text)
"""