Skip to content

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

fix:using f-string to refer outer variable

mingzhong.li058810c796ee
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.py
index 810f0f160..637c90f34 100644
--- a/browser_use/browser/context.py
+++ b/browser_use/browser/context.py
@@ -960,7 +960,7 @@ class BrowserContext:
# glob patterns are very easy to mess up and match too many domains by accident
# e.g. if you only need to access gmail, don't use *.google.com because an attacker could convince the agent to visit a malicious doc
# on docs.google.com/s/some/evil/doc to set up a prompt injection attack
- "⚠️ Allowing agent to visit {domain} based on allowed_domains=['{glob}', ...]. Set allowed_domains=['{domain}', ...] explicitly to avoid the security risks of glob patterns!"
+ f"⚠️ Allowing agent to visit {domain} based on allowed_domains=['{glob}', ...]. Set allowed_domains=['{domain}', ...] explicitly to avoid the security risks of glob patterns!"
)
_GLOB_WARNING_SHOWN = True