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
time_execution_async import
Magnus Mülleraad4b932bfce
diff --git a/browser_use/browser/python_highlights.py b/browser_use/browser/python_highlights.pyindex a27a0f80e..541313e0e 100644--- a/browser_use/browser/python_highlights.py+++ b/browser_use/browser/python_highlights.py@@ -93,18 +93,20 @@ def draw_enhanced_bounding_box_with_text(# Draw much bigger index overlay if we have index textif text:try:- # Use much bigger font size for visible index boxes+ # Scale font size based on image dimensions for consistent appearance across viewports+ img_width, img_height = image_size+ # Base font size scales with viewport width (36px for 1200px viewport)+ base_font_size = max(16, min(48, int(img_width * 0.03))) # 3% of viewport widthbig_font = None- font_size = 36 # Much bigger, more visible sizetry:- big_font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', font_size)+ big_font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', base_font_size)except OSError:try:- big_font = ImageFont.truetype('arial.ttf', font_size)+ big_font = ImageFont.truetype('arial.ttf', base_font_size)except OSError:# Try system fonts on different platformstry:- big_font = ImageFont.truetype('Arial Bold.ttf', font_size)+ big_font = ImageFont.truetype('Arial Bold.ttf', base_font_size)except OSError:big_font = font # Fallback to original font@@ -119,8 +121,8 @@ def draw_enhanced_bounding_box_with_text(text_width = bbox_text[2] - bbox_text[0]text_height = bbox_text[3] - bbox_text[1]- # Bigger padding for more prominent index boxes - extra space for large font- padding = 6+ # Scale padding based on viewport size for consistent appearance+ padding = max(4, int(img_width * 0.005)) # 0.5% of viewport widthelement_width = x2 - x1element_height = y2 - y1diff --git a/browser_use/browser/watchdogs/dom_watchdog.py b/browser_use/browser/watchdogs/dom_watchdog.pyindex af6205211..33cad6257 100644--- a/browser_use/browser/watchdogs/dom_watchdog.py+++ b/browser_use/browser/watchdogs/dom_watchdog.py@@ -4,8 +4,6 @@ import asyncioimport timefrom typing import TYPE_CHECKING-from utils import time_execution_async-from browser_use.browser.events import (BrowserErrorEvent,BrowserStateRequestEvent,@@ -19,6 +17,7 @@ from browser_use.dom.views import (SerializedDOMState,)from browser_use.observability import observe_debug+from browser_use.utils import time_execution_asyncif TYPE_CHECKING:from browser_use.browser.views import BrowserStateSummary, PageInfo