Skip to content

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

massively improve logging experience and add loading animation on browser startup

Nick Sweetingf6ca4e13a383
diff --git a/browser_use/__init__.py b/browser_use/__init__.py
index 4a9f3400e..46612163d 100644
--- a/browser_use/__init__.py
+++ b/browser_use/__init__.py
@@ -1,11 +1,3 @@
-import warnings
-
-# Suppress specific deprecation warnings from FAISS
-warnings.filterwarnings('ignore', category=DeprecationWarning, module='faiss.loader')
-warnings.filterwarnings('ignore', message='builtin type SwigPyPacked has no __module__ attribute')
-warnings.filterwarnings('ignore', message='builtin type SwigPyObject has no __module__ attribute')
-warnings.filterwarnings('ignore', message='builtin type swigvarlink has no __module__ attribute')
-
from browser_use.logging_config import setup_logging
setup_logging()
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index 422c0bf19..999e6ba6b 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -268,6 +268,10 @@ class MessageManager:
# Standard content extraction
content = self._clean_whitespace(str(m.message.content)[:80])
+ # Shorten "Action result:" to "Result:" for display
+ if content.startswith('Action result:'):
+ content = 'Result:' + content[14:]
+
# Handle AIMessages with tool calls
if hasattr(m.message, 'tool_calls') and m.message.tool_calls and not content:
tool_call = m.message.tool_calls[0]
@@ -281,24 +285,23 @@ class MessageManager:
content += '...'
# Format the message line
- left_part = f' {emoji}[{m.metadata.tokens}]'
+ left_part = f' {emoji}[{m.metadata.tokens}]'
# For last message, allow multiple lines if needed
if is_last_message and '\n' not in content:
- wrapped = textwrap.wrap(content, width=80, subsequent_indent=' ' * 14)
+ wrapped = textwrap.wrap(content, width=80, subsequent_indent=' ' * 20)
if len(wrapped) > 2:
wrapped = wrapped[:2]
wrapped[-1] = self._truncate_text(wrapped[-1], 77)
- message_lines.append(f'{left_part.ljust(12)}: {wrapped[0]}')
+ message_lines.append(f'{left_part.ljust(16)}: {wrapped[0]}')
message_lines.extend(wrapped[1:])
else:
- message_lines.append(f'{left_part.ljust(12)}: {content}')
+ message_lines.append(f'{left_part.ljust(16)}: {content}')
# Build final log message
return (
- f'Messages in history: {len(self.state.history.messages)}:\n'
+ f'πŸ“œ LLM Message history ({len(self.state.history.messages)} messages, {total_input_tokens} tokens):\n'
+ '\n'.join(message_lines)
- + f'\nTotal input tokens: {total_input_tokens}'
)
@time_execution_sync('--get_messages')
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 51ab90f2d..cffd3038a 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -85,33 +85,33 @@ def log_response(response: AgentOutput, registry=None) -> None:
logger.info(f'{emoji} Eval: {response.current_state.evaluation_previous_goal}')
logger.info(f'🧠 Memory: {response.current_state.memory}')
logger.info(f'🎯 Next goal: {response.current_state.next_goal}')
- for i, action in enumerate(response.action):
- # Extract action name and parameters from the action model
- action_data = action.model_dump(exclude_unset=True)
- action_name = next(iter(action_data.keys())) if action_data else 'unknown'
-
- # Get the parameters for this action
- action_params = action_data.get(action_name, {}) if action_data else {}
-
- # Get actual function module if registry is available
- module_path = 'browser_use.controller.service'
- if registry and action_name in registry.actions:
- action_function = registry.actions[action_name].function
- if hasattr(action_function, '__module__'):
- module_path = action_function.__module__
-
- # Format parameters as function call arguments
- if action_params:
- param_strings = []
- for key, value in action_params.items():
- if isinstance(value, str):
- param_strings.append(f'{key}="{value}"')
- else:
- param_strings.append(f'{key}={value}')
- params_str = ', '.join(param_strings)
- logger.info(f'πŸ› οΈ Next Action {i + 1}/{len(response.action)}: {module_path}.{action_name}({params_str})')
- else:
- logger.info(f'πŸ› οΈ Next Action {i + 1}/{len(response.action)}: {module_path}.{action_name}()')
+ # for i, action in enumerate(response.action):
+ # Extract action name and parameters from the action model
+ # action_data = action.model_dump(exclude_unset=True)
+ # action_name = next(iter(action_data.keys())) if action_data else 'unknown'
+
+ # Get the parameters for this action
+ # action_params = action_data.get(action_name, {}) if action_data else {}
+
+ # Get actual function module if registry is available
+ # module_path = 'browser_use.controller.service'
+ # if registry and action_name in registry.actions:
+ # action_function = registry.actions[action_name].function
+ # if hasattr(action_function, '__module__'):
+ # module_path = action_function.__module__
+
+ # Format parameters as function call arguments
+ # if action_params:
+ # param_strings = []
+ # for key, value in action_params.items():
+ # if isinstance(value, str):
+ # param_strings.append(f'{key}="{value}"')
+ # else:
+ # param_strings.append(f'{key}={value}')
+ # params_str = ', '.join(param_strings)
+ # logger.info(f'πŸ› οΈ Next Action {i + 1}/{len(response.action)}: {action_name}({params_str})')
+ # else:
+ # logger.info(f'πŸ› οΈ Next Action {i + 1}/{len(response.action)}: {action_name}()') # {module_path}.{action_name}
Context = TypeVar('Context')
@@ -880,7 +880,9 @@ class Agent(Generic[Context]):
"""Log step context information"""
url_short = current_page.url[:50] + '...' if len(current_page.url) > 50 else current_page.url
interactive_count = len(browser_state_summary.selector_map) if browser_state_summary else 0
- logger.info(f'πŸ“ Step {self.state.n_steps}: Evaluating {url_short} ({interactive_count} interactive elements)...')
+ logger.info(
+ f'πŸ“ Step {self.state.n_steps}: Evaluating page with {interactive_count} interactive elements on: {url_short}'
+ )
def _log_next_action_summary(self, parsed: 'AgentOutput') -> None:
"""Log a comprehensive summary of the next action(s)"""
@@ -917,12 +919,12 @@ class Agent(Generic[Context]):
# Create summary based on single vs multi-action
if action_count == 1:
- logger.debug(f'⚑️ Decided next action: {action_details[0]}')
+ logger.info(f'⚑️ Decided next action: {action_details[0]}')
else:
summary_lines = [f'⚑️ Decided next {action_count} multi-actions:']
for i, detail in enumerate(action_details):
summary_lines.append(f' {i + 1}. {detail}')
- logger.debug('\n'.join(summary_lines))
+ logger.info('\n'.join(summary_lines))
def _log_step_completion_summary(self, step_start_time: float, result: list[ActionResult]) -> None:
"""Log step completion summary with action count, timing, and success/failure stats"""
@@ -942,9 +944,7 @@ class Agent(Generic[Context]):
status_parts = [part for part in [success_indicator, failure_indicator] if part]
status_str = ' | '.join(status_parts) if status_parts else 'βœ… 0'
- logger.info(
- f'πŸ“ Step {self.state.n_steps}: Complete. Ran {action_count} action{"s" if action_count != 1 else ""} in {step_duration:.2f}s: {status_str}'
- )
+ logger.info(f'πŸ“ Step {self.state.n_steps}: Ran {action_count} actions in {step_duration:.2f}s: {status_str}')
def _log_llm_call_info(self, input_messages: list[BaseMessage], method: str) -> None:
"""Log comprehensive information about the LLM call being made"""
@@ -963,7 +963,7 @@ class Agent(Generic[Context]):
output_type = 'raw text output' if method == 'raw' else 'structured output + tools'
image_status = 'πŸ“· images' if has_images else 'no images'
- logger.debug(
+ logger.info(
f'🧠 LLM call: {self.chat_model_library} ({method}) | {message_count} msgs, ~{current_tokens} tokens, {total_chars} chars | {image_status} | {output_type}'
)
@@ -1088,7 +1088,7 @@ class Agent(Generic[Context]):
# Check control flags before each step
if self.state.stopped:
- logger.info('Agent stopped')
+ logger.info('πŸ›‘ Agent stopped')
agent_run_error = 'Agent stopped programmatically'
break
@@ -1242,7 +1242,7 @@ class Agent(Generic[Context]):
# Get action name from the action model
action_data = action.model_dump(exclude_unset=True)
action_name = next(iter(action_data.keys())) if action_data else 'unknown'
- logger.debug(f'Executed action {i + 1} / {len(actions)}: {action_name}()')
+ logger.info(f'β˜‘οΈ Executed action {i + 1}/{len(actions)}: {action_name}')
if results[-1].is_done or results[-1].error or i == len(actions) - 1:
break
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 3d06755a5..6c5449481 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -628,11 +628,15 @@ class BrowserSession(BaseModel):
# TODO: implement applying self.stroage_state to an existing browser_context
# await self.browser_context.set_storage_state(self.storage_state)
- # apply viewport size settings to any existing pages
- if viewport:
- for page in self.browser_context.pages:
+ for page in self.browser_context.pages:
+ # apply viewport size settings to any existing pages
+ if viewport:
await page.set_viewport_size(viewport)
+ # show browser-use dvd screensaver-style bouncing loading animation on any about:blank pages
+ if page.url == 'about:blank':
+ await self._show_dvd_screensaver_loading_animation(page)
+
def _set_browser_keep_alive(self, keep_alive: bool | None) -> None:
"""set the keep_alive flag on the browser_profile, defaulting to True if keep_alive is None"""
if self.browser_profile.keep_alive is None:
@@ -1914,6 +1918,14 @@ class BrowserSession(BaseModel):
# else:
# assert self.agent_current_page.url == 'about:blank'
+ # if there are any unused about:blank tabs after we open a new tab, close them to clean up unused tabs
+ for page in self.browser_context.pages:
+ if page.url == 'about:blank' and page != self.agent_current_page:
+ await page.close()
+ self.human_current_page = ( # in case we just closed the human's tab, fix the refs
+ self.human_current_page if not self.human_current_page.is_closed() else self.agent_current_page
+ )
+
return new_page
# region - Helper methods for easier access to the DOM
@@ -2000,3 +2012,96 @@ class BrowserSession(BaseModel):
}"""
page = await self.get_current_page()
await page.evaluate(SMART_SCROLL_JS, pixels)
+
+ # --- DVD Screensaver Loading Animation Helper ---
+ async def _show_dvd_screensaver_loading_animation(self, page: Page) -> None:
+ """
+ Injects a DVD screensaver-style bouncing logo loading animation overlay into the given Playwright Page.
+ This is used to visually indicate that the browser is setting up or waiting.
+ """
+ await page.evaluate("""() => {
+ document.title = 'Setting up...';
+
+ // Create the main overlay
+ const loadingOverlay = document.createElement('div');
+ loadingOverlay.id = 'pretty-loading-animation';
+ loadingOverlay.style.position = 'fixed';
+ loadingOverlay.style.top = '0';
+ loadingOverlay.style.left = '0';
+ loadingOverlay.style.width = '100vw';
+ loadingOverlay.style.height = '100vh';
+ loadingOverlay.style.background = '#000';
+ loadingOverlay.style.zIndex = '99999';
+ loadingOverlay.style.overflow = 'hidden';
+
+ // Create the image element
+ const img = document.createElement('img');
+ img.src = 'https://github.com/browser-use.png';
+ img.alt = 'Browser-Use';
+ img.style.width = '200px';
+ img.style.height = 'auto';
+ img.style.position = 'absolute';
+ img.style.left = '0px';
+ img.style.top = '0px';
+ img.style.zIndex = '2';
+ img.style.opacity = '0.8';
+
+ loadingOverlay.appendChild(img);
+ document.body.appendChild(loadingOverlay);
+
+ // DVD screensaver bounce logic
+ let x = Math.random() * (window.innerWidth - 300);
+ let y = Math.random() * (window.innerHeight - 300);
+ let dx = 1.2 + Math.random() * 0.4; // px per frame
+ let dy = 1.2 + Math.random() * 0.4;
+ // Randomize direction
+ if (Math.random() > 0.5) dx = -dx;
+ if (Math.random() > 0.5) dy = -dy;
+
+ function animate() {
+ const imgWidth = img.offsetWidth || 300;
+ const imgHeight = img.offsetHeight || 300;
+ x += dx;
+ y += dy;
+
+ if (x <= 0) {
+ x = 0;
+ dx = Math.abs(dx);
+ } else if (x + imgWidth >= window.innerWidth) {
+ x = window.innerWidth - imgWidth;
+ dx = -Math.abs(dx);
+ }
+ if (y <= 0) {
+ y = 0;
+ dy = Math.abs(dy);
+ } else if (y + imgHeight >= window.innerHeight) {
+ y = window.innerHeight - imgHeight;
+ dy = -Math.abs(dy);
+ }
+
+ img.style.left = `${x}px`;
+ img.style.top = `${y}px`;
+
+ requestAnimationFrame(animate);
+ }
+ animate();
+
+ // Responsive: update bounds on resize
+ window.addEventListener('resize', () => {
+ x = Math.min(x, window.innerWidth - img.offsetWidth);
+ y = Math.min(y, window.innerHeight - img.offsetHeight);
+ });
+
+ // Add a little CSS for smoothness
+ const style = document.createElement('style');
+ style.innerHTML = `
+ #pretty-loading-animation {
+ /*backdrop-filter: blur(2px) brightness(0.9);*/
+ }
+ #pretty-loading-animation img {
+ user-select: none;
+ pointer-events: none;
+ }
+ `;
+ document.head.appendChild(style);
+ }""")
diff --git a/browser_use/controller/registry/service.py b/browser_use/controller/registry/service.py
index e49903452..c58198145 100644
--- a/browser_use/controller/registry/service.py
+++ b/browser_use/controller/registry/service.py
@@ -256,6 +256,12 @@ class Registry(Generic[Context]):
except Exception as e:
raise RuntimeError(f'Error executing action {action_name}: {str(e)}') from e
+ def _log_sensitive_data_usage(self, placeholders_used: set[str], current_url: str | None) -> None:
+ """Log when sensitive data is being used on a page"""
+ if placeholders_used:
+ url_info = f' on {current_url}' if current_url and current_url != 'about:blank' else ''
+ logger.info(f'πŸ”’ Using sensitive data placeholders: {", ".join(sorted(placeholders_used))}{url_info}')
+
def _replace_sensitive_data(
self, params: BaseModel, sensitive_data: dict[str, Any], browser_session: BrowserSession = None
) -> BaseModel:
@@ -275,6 +281,8 @@ class Registry(Generic[Context]):
# Set to track all missing placeholders across the full object
all_missing_placeholders = set()
+ # Set to track successfully replaced placeholders
+ replaced_placeholders = set()
# Determine current URL if browser_session is provided
current_url = None
@@ -315,6 +323,7 @@ class Registry(Generic[Context]):
for placeholder in matches:
if placeholder in applicable_secrets:
value = value.replace(f'<secret>{placeholder}</secret>', applicable_secrets[placeholder])
+ replaced_placeholders.add(placeholder)
else:
# Keep track of missing placeholders
all_missing_placeholders.add(placeholder)
@@ -330,6 +339,9 @@ class Registry(Generic[Context]):
params_dump = params.model_dump()
processed_params = replace_secrets(params_dump)
+ # Log sensitive data usage
+ self._log_sensitive_data_usage(replaced_placeholders, current_url)
+
# Log a warning if any placeholders are missing
if all_missing_placeholders:
logger.warning(f'Missing or empty keys in sensitive_data dictionary: {", ".join(all_missing_placeholders)}')
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index a7b4f28d6..f22bfc94d 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -79,18 +79,19 @@ class Controller(Generic[Context]):
# Basic Navigation Actions
@self.registry.action(
- 'Search the query in Google in the current tab, the query should be a search query like humans search in Google, concrete and not vague or super long. More the single most important items. ',
+ 'Search the query in Google, the query should be a search query like humans search in Google, concrete and not vague or super long.',
param_model=SearchGoogleAction,
)
async def search_google(params: SearchGoogleAction, browser_session: BrowserSession):
search_url = f'https://www.google.com/search?q={params.query}&udm=14'
page = await browser_session.get_current_page()
- if page:
+ if page.url in ('about:blank', 'https://www.google.com'):
await page.goto(search_url)
await page.wait_for_load_state()
else:
page = await browser_session.create_new_tab(search_url)
+
msg = f'πŸ” Searched for "{params.query}" in Google'
logger.info(msg)
return ActionResult(extracted_content=msg, include_in_memory=True)
@@ -179,9 +180,7 @@ class Controller(Generic[Context]):
return ActionResult(extracted_content=msg, include_in_memory=True)
# Save PDF
- @self.registry.action(
- 'Save the current page as a PDF file',
- )
+ @self.registry.action('Save the current page as a PDF file')
async def save_pdf(browser_session: BrowserSession):
page = await browser_session.get_current_page()
short_url = re.sub(r'^https?://(?:www\.)?|/$', '', page.url)
@@ -205,7 +204,9 @@ class Controller(Generic[Context]):
logger.info(msg)
return ActionResult(extracted_content=msg, include_in_memory=True)
- @self.registry.action('Open url in new tab', param_model=OpenTabAction)
+ @self.registry.action(
+ 'Open url in new tab, (for Google search use search_google action instead)', param_model=OpenTabAction
+ )
async def open_tab(params: OpenTabAction, browser_session: BrowserSession):
await browser_session.create_new_tab(params.url)
msg = f'πŸ”— Opened new tab with {params.url}'
@@ -218,7 +219,9 @@ class Controller(Generic[Context]):
page = await browser_session.get_current_page()
url = page.url
await page.close()
- msg = f'❌ Closed tab #{params.page_id} with url {url}'
+ new_page = await browser_session.get_current_page()
+ new_page_idx = browser_session.tabs.index(new_page)
+ msg = f'❌ Closed tab #{params.page_id} with {url}, now focused on tab #{new_page_idx} with url {new_page.url}'
logger.info(msg)
return ActionResult(extracted_content=msg, include_in_memory=True)
@@ -773,7 +776,7 @@ class Controller(Generic[Context]):
return ActionResult(error=error_msg, include_in_memory=True)
@self.registry.action('Google Sheets: Get the contents of the entire sheet', domains=['https://docs.google.com'])
- async def get_sheet_contents(browser_session: BrowserSession):
+ async def read_sheet_contents(browser_session: BrowserSession):
page = await browser_session.get_current_page()
# select all cells
@@ -785,6 +788,43 @@ class Controller(Generic[Context]):
extracted_tsv = await page.evaluate('() => navigator.clipboard.readText()')
return ActionResult(extracted_content=extracted_tsv, include_in_memory=True)
+ @self.registry.action('Google Sheets: Get the contents of a cell or range of cells', domains=['https://docs.google.com'])
+ async def read_cell_contents(browser_session: BrowserSession, cell_or_range: str):
+ page = await browser_session.get_current_page()
+
+ await select_cell_or_range(browser_session, cell_or_range)
+
+ await page.keyboard.press('ControlOrMeta+C')
+ await asyncio.sleep(0.1)
+ extracted_tsv = await page.evaluate('() => navigator.clipboard.readText()')
+ return ActionResult(extracted_content=extracted_tsv, include_in_memory=True)
+
+ @self.registry.action(
+ 'Google Sheets: Update the content of a cell or range of cells', domains=['https://docs.google.com']
+ )
+ async def update_cell_contents(browser_session: BrowserSession, cell_or_range: str, new_contents_tsv: str):
+ page = await browser_session.get_current_page()
+
+ await select_cell_or_range(browser_session, cell_or_range)
+
+ # simulate paste event from clipboard with TSV content
+ await page.evaluate(f"""
+ const clipboardData = new DataTransfer();
+ clipboardData.setData('text/plain', `{new_contents_tsv}`);
+ document.activeElement.dispatchEvent(new ClipboardEvent('paste', {{clipboardData}}));
+ """)
+
+ return ActionResult(extracted_content=f'Updated cells: {cell_or_range} = {new_contents_tsv}', include_in_memory=False)
+
+ @self.registry.action('Google Sheets: Clear whatever cells are currently selected', domains=['https://docs.google.com'])
+ async def clear_cell_contents(browser_session: BrowserSession, cell_or_range: str):
+ page = await browser_session.get_current_page()
+
+ await select_cell_or_range(browser_session, cell_or_range)
+
+ await page.keyboard.press('Backspace')
+ return ActionResult(extracted_content=f'Cleared cells: {cell_or_range}', include_in_memory=False)
+
@self.registry.action('Google Sheets: Select a specific cell or range of cells', domains=['https://docs.google.com'])
async def select_cell_or_range(browser_session: BrowserSession, cell_or_range: str):
page = await browser_session.get_current_page()
@@ -802,30 +842,13 @@ class Controller(Generic[Context]):
await page.keyboard.press('Enter')
await asyncio.sleep(0.2)
await page.keyboard.press('Escape') # to make sure the popup still closes in the case where the jump failed
- return ActionResult(extracted_content=f'Selected cell {cell_or_range}', include_in_memory=False)
+ return ActionResult(extracted_content=f'Selected cells: {cell_or_range}', include_in_memory=False)
@self.registry.action(
- 'Google Sheets: Get the contents of a specific cell or range of cells', domains=['https://docs.google.com']
+ 'Google Sheets: Fallback method to type text into (only one) currently selected cell',
+ domains=['https://docs.google.com'],
)
- async def get_range_contents(browser_session: BrowserSession, cell_or_range: str):
- page = await browser_session.get_current_page()
-
- await select_cell_or_range(browser_session, cell_or_range)
-
- await page.keyboard.press('ControlOrMeta+C')
- await asyncio.sleep(0.1)
- extracted_tsv = await page.evaluate('() => navigator.clipboard.readText()')
- return ActionResult(extracted_content=extracted_tsv, include_in_memory=True)
-
- @self.registry.action('Google Sheets: Clear the currently selected cells', domains=['https://docs.google.com'])
- async def clear_selected_range(browser_session: BrowserSession):
- page = await browser_session.get_current_page()
-
- await page.keyboard.press('Backspace')
- return ActionResult(extracted_content='Cleared selected range', include_in_memory=False)
-
- @self.registry.action('Google Sheets: Input text into the currently selected cell', domains=['https://docs.google.com'])
- async def input_selected_cell_text(browser_session: BrowserSession, text: str):
+ async def fallback_input_into_single_selected_cell(browser_session: BrowserSession, text: str):
page = await browser_session.get_current_page()
await page.keyboard.type(text, delay=0.1)
@@ -833,22 +856,6 @@ class Controller(Generic[Context]):
await page.keyboard.press('ArrowUp')
return ActionResult(extracted_content=f'Inputted text {text}', include_in_memory=False)
- @self.registry.action('Google Sheets: Batch update a range of cells', domains=['https://docs.google.com'])
- async def update_range_contents(browser_session: BrowserSession, range: str, new_contents_tsv: str):
- page = await browser_session.get_current_page()
-
- # Pass browser_session positionally to avoid the "multiple values" error
- await select_cell_or_range(browser_session, range)
-
- # simulate paste event from clipboard with TSV content
- await page.evaluate(f"""
- const clipboardData = new DataTransfer();
- clipboardData.setData('text/plain', `{new_contents_tsv}`);
- document.activeElement.dispatchEvent(new ClipboardEvent('paste', {{clipboardData}}));
- """)
-
- return ActionResult(extracted_content=f'Updated cell {range} with {new_contents_tsv}', include_in_memory=False)
-
# Register ---------------------------------------------------------------
def action(self, description: str, **kwargs):
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.py
index 3114e5c36..3edffa1bb 100644
--- a/browser_use/dom/service.py
+++ b/browser_use/dom/service.py
@@ -108,7 +108,7 @@ class DomService:
# Get key metrics for summary
total_nodes = perf.get('nodeMetrics', {}).get('totalNodes', 0)
- processed_nodes = perf.get('nodeMetrics', {}).get('processedNodes', 0)
+ # processed_nodes = perf.get('nodeMetrics', {}).get('processedNodes', 0)
# Count interactive elements from the DOM map
interactive_count = 0
@@ -120,11 +120,11 @@ class DomService:
# Create concise summary
url_short = self.page.url[:50] + '...' if len(self.page.url) > 50 else self.page.url
logger.debug(
- 'ran buildDOMTree.js on: %s total_nodes=%d processed=%d interactive=%d',
+ 'πŸ”Ž Ran buildDOMTree.js interactive element detection on: %s interactive=%d total=%d',
url_short,
- total_nodes,
- processed_nodes,
interactive_count,
+ total_nodes,
+ # processed_nodes,
)
return await self._construct_dom_tree(eval_page)
diff --git a/browser_use/logging_config.py b/browser_use/logging_config.py
index 4b62d6141..dc1f86085 100644
--- a/browser_use/logging_config.py
+++ b/browser_use/logging_config.py
@@ -1,6 +1,7 @@
import logging
import os
import sys
+import warnings
from dotenv import load_dotenv
@@ -59,6 +60,12 @@ def addLoggingLevel(levelName, levelNum, methodName=None):
def setup_logging():
+ # Suppress specific deprecation warnings from FAISS
+ warnings.filterwarnings('ignore', category=DeprecationWarning, module='faiss.loader')
+ warnings.filterwarnings('ignore', message='builtin type SwigPyPacked has no __module__ attribute')
+ warnings.filterwarnings('ignore', message='builtin type SwigPyObject has no __module__ attribute')
+ warnings.filterwarnings('ignore', message='builtin type swigvarlink has no __module__ attribute')
+
# Try to add RESULT level, but ignore if it already exists
try:
addLoggingLevel('RESULT', 35) # This allows ERROR, FATAL and CRITICAL
diff --git a/examples/use-cases/google_sheets.py b/examples/use-cases/google_sheets.py
index a110a5050..fda5d1673 100644
--- a/examples/use-cases/google_sheets.py
+++ b/examples/use-cases/google_sheets.py
@@ -48,7 +48,7 @@ async def main():
eraser = Agent(
task="""
- Clear all the existing values in columns A through F in this Google Sheet:
+ Clear all the existing values in columns A through M in this Google Sheet:
https://docs.google.com/spreadsheets/d/1INaIcfpYXlMRWO__de61SHFCaqt1lfHlcvtXZPItlpI/edit
""",
llm=model,
@@ -59,15 +59,16 @@ async def main():
researcher = Agent(
task="""
- Google to find the full name, nationality, and date of birth of the CEO of the top 10 Fortune 100 companies.
- For each company, append a row to this existing Google Sheet: https://docs.google.com/spreadsheets/d/1INaIcfpYXlMRWO__de61SHFCaqt1lfHlcvtXZPItlpI/edit
+ Open this Google Sheet and read it to understand the structure: https://docs.google.com/spreadsheets/d/1INaIcfpYXlMRWO__de61SHFCaqt1lfHlcvtXZPItlpI/edit
Make sure column headers are present and all existing values in the sheet are formatted correctly.
Columns:
A: Company Name
B: CEO Full Name
C: CEO Country of Birth
- D: CEO Date of Birth (YYYY-MM-DD)
- E: Source URL where the information was found
+ D: Source URL where the information was found
+ Then Google to find the full name and nationality of the CEO of the top 10 Fortune 100 companies.
+ For each company, append a row to this existing Google Sheet.
+ At the end, double check the formatting and structure and fix any issues by updating/overwriting cells.
""",
llm=model,
browser_session=browser_session,
@@ -86,17 +87,17 @@ async def main():
)
await improvised_continuer.run()
- final_fact_checker = Agent(
- task="""
- Read the Google Sheet https://docs.google.com/spreadsheets/d/1INaIcfpYXlMRWO__de61SHFCaqt1lfHlcvtXZPItlpI/edit
- Fact-check every entry, add a new column F with your findings for each row.
- Make sure to check the source URL for each row, and make sure the information is correct.
- """,
- llm=model,
- browser_session=browser_session,
- controller=controller,
- )
- await final_fact_checker.run()
+ # final_fact_checker = Agent(
+ # task="""
+ # Read the Google Sheet https://docs.google.com/spreadsheets/d/1INaIcfpYXlMRWO__de61SHFCaqt1lfHlcvtXZPItlpI/edit
+ # Fact-check every entry, add a new column F with your findings for each row.
+ # Make sure to check the source URL for each row, and make sure the information is correct.
+ # """,
+ # llm=model,
+ # browser_session=browser_session,
+ # controller=controller,
+ # )
+ # await final_fact_checker.run()
if __name__ == '__main__':