Skip to content

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

Update BrowserProfile and BrowserSession to utilize dom_highlight_elements for DOM highlighting

kalil0321b60260068690
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.py
index 89855314c..732a5dc55 100644
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@ -621,7 +621,9 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
# --- UI/viewport/DOM ---
highlight_elements: bool = Field(default=True, description='Highlight interactive elements on the page.')
- dom_highlight_elements: bool = Field(default=False, description='Highlight interactive elements in the DOM (only for debugging purposes).')
+ dom_highlight_elements: bool = Field(
+ default=False, description='Highlight interactive elements in the DOM (only for debugging purposes).'
+ )
filter_highlight_ids: bool = Field(
default=True, description='Only show element IDs in highlights if llm_representation is less than 10 characters.'
)
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 71c095149..a9721369a 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -1817,7 +1817,7 @@ class BrowserSession(BaseModel):
async def add_highlights(self, selector_map: dict[int, 'EnhancedDOMTreeNode']) -> None:
"""Add visual highlights to the browser DOM for user visibility."""
- if not self.browser_profile.highlight_elements or not selector_map:
+ if not self.browser_profile.dom_highlight_elements or not selector_map:
return
try: