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
Add validation to BrowserProfile to prevent conflict between highlight_elements and dom_highlight_elements
kalil0321aea2266742bf
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.pyindex 732a5dc55..ee413acb8 100644--- a/browser_use/browser/profile.py+++ b/browser_use/browser/profile.py@@ -734,6 +734,17 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Brologger.warning('BrowserProfile.proxy.bypass provided but proxy has no server; bypass will be ignored.')return self+ @model_validator(mode='after')+ def validate_highlight_elements_conflict(self) -> Self:+ """Ensure highlight_elements and dom_highlight_elements are not both enabled, with dom_highlight_elements taking priority."""+ if self.highlight_elements and self.dom_highlight_elements:+ logger.warning(+ '⚠️ Both highlight_elements and dom_highlight_elements are enabled. '+ 'dom_highlight_elements takes priority. Setting highlight_elements=False.'+ )+ self.highlight_elements = False+ return self+def model_post_init(self, __context: Any) -> None:"""Called after model initialization to set up display configuration."""self.detect_display_configuration()