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
Less priming for scroll
Magnus Müllerc4b9710a84e9
diff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.pyindex 1adc10ba3..bcf00fed0 100644--- a/browser_use/agent/prompts.py+++ b/browser_use/agent/prompts.py@@ -205,7 +205,7 @@ class AgentMessagePrompt:if page_stats['total_elements'] < 10:stats_text += 'Page appears empty (SPA not loaded?) - 'stats_text += f'{page_stats["links"]} links, {page_stats["interactive_elements"]} interactive, '- stats_text += f'{page_stats["iframes"]} iframes, {page_stats["scroll_containers"]} scroll containers'+ stats_text += f'{page_stats["iframes"]} iframes'if page_stats['shadow_open'] > 0 or page_stats['shadow_closed'] > 0:stats_text += f', {page_stats["shadow_open"]} shadow(open), {page_stats["shadow_closed"]} shadow(closed)'if page_stats['images'] > 0:diff --git a/browser_use/agent/system_prompts/system_prompt.md b/browser_use/agent/system_prompts/system_prompt.mdindex fe831db70..86248e26a 100644--- a/browser_use/agent/system_prompts/system_prompt.md+++ b/browser_use/agent/system_prompts/system_prompt.md@@ -64,10 +64,8 @@ Strictly follow these rules while using the browser and navigating the web:- Only use indexes that are explicitly provided.- If research is needed, open a **new tab** instead of reusing the current one.- If the page changes after, for example, an input text action, analyse if you need to interact with new elements, e.g. selecting the right option from the list.-- By default, only elements in the visible viewport are listed. Use scrolling tools if you suspect relevant content is offscreen which you need to interact with. Scroll ONLY if there are more pixels below or above the page.-- You can scroll by a specific number of pages using the pages parameter (e.g., 0.5 for half page, 2.0 for two pages).+- By default, only elements in the visible viewport are listed.- If a captcha appears, attempt solving it if possible. If not, use fallback strategies (e.g., alternative site, backtrack).-- If expected elements are missing, try refreshing, scrolling, or navigating back.- If the page is not fully loaded, use the wait action.- You can call extract on specific pages to gather structured semantic information from the entire page, including parts not currently visible.- Call extract only if the information you are looking for is not visible in your <browser_state> otherwise always just use the needed text from the <browser_state>.@@ -120,7 +118,6 @@ You can output multiple actions in one step. Try to be efficient where it makes- `input` + `click` → Fill form field and submit/search in one step- `input` + `input` → Fill multiple form fields- `click` + `click` → Navigate through multi-step flows (when the page does not navigate between clicks)-- `scroll` with pages 2-3 + `extract` → Only for infinite scroll pages: scroll moderately to load more content before extracting- File operations + browser actionsDo not try multiple different paths in one step. Always have one clear goal per step.Its important that you see in the next step if your action was successful, so do not chain actions which change the browser state multiple times, e.g.diff --git a/browser_use/agent/system_prompts/system_prompt_flash.md b/browser_use/agent/system_prompts/system_prompt_flash.mdindex 054cd5f3b..7cefa3003 100644--- a/browser_use/agent/system_prompts/system_prompt_flash.md+++ b/browser_use/agent/system_prompts/system_prompt_flash.md@@ -2,7 +2,7 @@ You are an AI agent designed to operate in an iterative loop to automate browser<language_settings>Default: English. Match user's language.</language_settings><user_request>Ultimate objective. Specific tasks: follow each step. Open-ended: plan approach.</user_request><browser_state>Elements: [index]<type>text</type>. Only [indexed] are interactive. Indentation=child. *[=new.</browser_state>-<file_system>- PDFs are auto-downloaded to available_file_paths - use read_file to read the doc or scroll and look at screenshot. You have access to persistent file system for progress tracking. Long tasks >10 steps: use todo.md: checklist for subtasks, update with replace_file_str when completing items. When writing CSV, use double quotes for commas. In available_file_paths, you can read downloaded files and user attachment files.</file_system>+<file_system>- PDFs are auto-downloaded to available_file_paths - use read_file to read the doc or look at screenshot. You have access to persistent file system for progress tracking. Long tasks >10 steps: use todo.md: checklist for subtasks, update with replace_file_str when completing items. When writing CSV, use double quotes for commas. In available_file_paths, you can read downloaded files and user attachment files.</file_system><action_rules>You are allowed to use a maximum of {max_actions} actions per step. Check the browser state each step to verify your previous action achieved its goal. When chaining multiple actions, never take consequential actions (submitting forms, clicking consequential buttons) without confirming necessary changes occurred.</action_rules>diff --git a/browser_use/agent/system_prompts/system_prompt_flash_anthropic.md b/browser_use/agent/system_prompts/system_prompt_flash_anthropic.mdindex 01182c55b..158a32e89 100644--- a/browser_use/agent/system_prompts/system_prompt_flash_anthropic.md+++ b/browser_use/agent/system_prompts/system_prompt_flash_anthropic.md@@ -6,7 +6,7 @@ User request is the ultimate objective. For tasks with specific instructions, foElements: [index]<type>text</type>. Only [indexed] are interactive. Indentation=child. *[=new.</browser_state><file_system>-PDFs are auto-downloaded to available_file_paths - use read_file to read the doc or scroll and look at screenshot. You have access to persistent file system for progress tracking and saving data. Long tasks >10 steps: use todo.md: checklist for subtasks, update with replace_file_str when completing items. In available_file_paths, you can read downloaded files and user attachment files.+PDFs are auto-downloaded to available_file_paths - use read_file to read the doc or look at screenshot. You have access to persistent file system for progress tracking and saving data. Long tasks >10 steps: use todo.md: checklist for subtasks, update with replace_file_str when completing items. In available_file_paths, you can read downloaded files and user attachment files.</file_system><action_rules>You are allowed to use a maximum of {max_actions} actions per step. Check the browser state each step to verify your previous action achieved its goal. When chaining multiple actions, never take consequential actions (submitting forms, clicking consequential buttons) without confirming necessary changes occurred.diff --git a/browser_use/agent/system_prompts/system_prompt_no_thinking.md b/browser_use/agent/system_prompts/system_prompt_no_thinking.mdindex 89883f252..086cf882e 100644--- a/browser_use/agent/system_prompts/system_prompt_no_thinking.md+++ b/browser_use/agent/system_prompts/system_prompt_no_thinking.md@@ -64,10 +64,8 @@ Strictly follow these rules while using the browser and navigating the web:- Only use indexes that are explicitly provided.- If research is needed, open a **new tab** instead of reusing the current one.- If the page changes after, for example, an input text action, analyse if you need to interact with new elements, e.g. selecting the right option from the list.-- By default, only elements in the visible viewport are listed. Use scrolling tools if you suspect relevant content is offscreen which you need to interact with. Scroll ONLY if there are more pixels below or above the page.-- You can scroll by a specific number of pages using the pages parameter (e.g., 0.5 for half page, 2.0 for two pages).+- By default, only elements in the visible viewport are listed.- If a captcha appears, attempt solving it if possible. If not, use fallback strategies (e.g., alternative site, backtrack).-- If expected elements are missing, try refreshing, scrolling, or navigating back.- If the page is not fully loaded, use the wait action.- You can call extract on specific pages to gather structured semantic information from the entire page, including parts not currently visible.- Call extract only if the information you are looking for is not visible in your <browser_state> otherwise always just use the needed text from the <browser_state>.@@ -120,7 +118,6 @@ You can output multiple actions in one step. Try to be efficient where it makes- `input` + `click` → Fill form field and submit/search in one step- `input` + `input` → Fill multiple form fields- `click` + `click` → Navigate through multi-step flows (when the page does not navigate between clicks)-- `scroll` with pages 2-3 + `extract` → For infinite scroll pages: scroll moderately to load more content before extracting- File operations + browser actionsDo not try multiple different paths in one step. Always have one clear goal per step.Its important that you see in the next step if your action was successful, so do not chain actions which change the browser state multiple times, e.g.diff --git a/browser_use/tools/service.py b/browser_use/tools/service.pyindex a0ab504cb..b10357e1a 100644--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@ -783,7 +783,7 @@ You will be given a query and the markdown of a webpage that has been filtered traise RuntimeError(str(e))@self.registry.action(- """Scroll by pages. REQUIRED: down=True/False (True=scroll down, False=scroll up, default=True). Optional: pages=0.5-10.0 (default 1.0). Use index for scroll containers (dropdowns/custom UI). High pages (10) reaches bottom. Multi-page scrolls sequentially. Viewport-based height, fallback 1000px/page.""",+ """Scroll by pages. REQUIRED: down=True/False (True=scroll down, False=scroll up, default=True). Optional: pages=0.5-10.0 (default 1.0). Use index for scroll elements (dropdowns/custom UI). High pages (10) reaches bottom. Multi-page scrolls sequentially. Viewport-based height, fallback 1000px/page.""",param_model=ScrollAction,)async def scroll(params: ScrollAction, browser_session: BrowserSession):diff --git a/browser_use/tools/views.py b/browser_use/tools/views.pyindex dbe338458..cf66b4122 100644--- a/browser_use/tools/views.py+++ b/browser_use/tools/views.py@@ -79,7 +79,7 @@ class CloseTabAction(BaseModel):class ScrollAction(BaseModel):down: bool = Field(default=True, description='down=True=scroll down, down=False scroll up')pages: float = Field(default=1.0, description='0.5=half page, 1=full page, 10=to bottom/top')- index: int | None = Field(default=None, description='Optional element index to scroll within specific container')+ index: int | None = Field(default=None, description='Optional element index to scroll within specific element')class SendKeysAction(BaseModel):