Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Wait function
Magnus Müller1dfc72aac44c
diff --git a/browser_use/agent/system_prompt.md b/browser_use/agent/system_prompt.mdindex b975b5093..d9779886e 100644--- a/browser_use/agent/system_prompt.md+++ b/browser_use/agent/system_prompt.md@@ -39,6 +39,7 @@ Common action sequences:- Use scroll to find elements you are looking for- If you want to research something, open a new tab instead of using the current tab- If captcha pops up, try to solve it - else try a different approach+- If the page is not fully loaded, use wait action5. TASK COMPLETION:- Use the done action as the last action as soon as the ultimate task is complete- Dont use "done" before you are done with everything the user asked you.diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex e430c3543..e339f384a 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -82,6 +82,14 @@ class Controller(Generic[Context]):logger.info(msg)return ActionResult(extracted_content=msg, include_in_memory=True)+ # wait for x seconds+ @self.registry.action('Wait for x seconds default 3')+ async def wait(seconds: int = 3):+ msg = f'🕒 Waiting for {seconds} seconds'+ logger.info(msg)+ await asyncio.sleep(seconds)+ return ActionResult(extracted_content=msg, include_in_memory=True)+# Element Interaction Actions@self.registry.action('Click element', param_model=ClickElementAction)async def click_element(params: ClickElementAction, browser: BrowserContext):