Skip to content

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

fix deprecation compat message

Nick Sweeting4429b89c4cb1
diff --git a/browser_use/browser/compat.py b/browser_use/browser/compat.py
index 85fc3221b..53465da6d 100644
--- a/browser_use/browser/compat.py
+++ b/browser_use/browser/compat.py
@@ -16,7 +16,7 @@ DEPRECATION_MESSAGE = """
headless=False,
args=['--start-maximized'],
ignore_default_args=['--enable-automation'],
- viewport={'width': 1920, 'height': 1080},
+ viewport={{'width': 1920, 'height': 1080}},
has_touch=False,
user_agent='...',
# ... see more: https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context
@@ -29,7 +29,7 @@ DEPRECATION_MESSAGE = """
allowed_domains=['example.com', '*.google.com'],
disable_security=False,
keep_alive=True,
- window_size={'width': 1920, 'height': 1080},
+ window_size={{'width': 1920, 'height': 1080}},
# ... see more: https://docs.browser-use.com/customize/browser-settings#context-configuration
)
@@ -66,7 +66,7 @@ class DeprecatedClass:
def __init__(self, *_args, **_kwargs):
print(DEPRECATION_MESSAGE.format(type(self).__name__))
raise NotImplementedError(
- 'The Browser, BrowserConfig, BrowserContext, BrowserContextConfig models have been moved to a simplified new design => 1 BrowserProfile + 1 BrowserSession.'
+ 'The old Browser, BrowserConfig, BrowserContext, BrowserContextConfig have been deprecated in favor of a simplified BrowserProfile + BrowserSession.'
)
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 73b2712fb..b73dadaa8 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import asyncio
import json
import logging
import os