Skip to content

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

Remove tab_handle from browser state tests

magmueller0e2237a2ecbf
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 022f02a10..9fcfe11b7 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -72,7 +72,7 @@
"justMyCode": false
},
{
- "name": "Python: Debug Current File",
+ "name": "pytest: Debug Current File",
"type": "python",
"request": "launch",
"module": "pytest",
diff --git a/browser_use/agent/tests.py b/browser_use/agent/tests.py
index 6271a4b16..f3ec0636d 100644
--- a/browser_use/agent/tests.py
+++ b/browser_use/agent/tests.py
@@ -19,8 +19,7 @@ def sample_browser_state():
return BrowserState(
url='https://example.com',
title='Example Page',
- current_tab_handle='tab1',
- tabs=[TabInfo(handle='tab1', url='https://example.com', title='Example Page')],
+ tabs=[TabInfo(url='https://example.com', title='Example Page', page_id=1)],
screenshot='screenshot1.png',
items=[
DomContentItem(index=1, text='Click me', is_text_only=False, depth=0),
@@ -78,8 +77,7 @@ def sample_history(action_registry):
state=BrowserState(
url='https://example.com',
title='Page 1',
- current_tab_handle='tab1',
- tabs=[TabInfo(handle='tab1', url='https://example.com', title='Page 1')],
+ tabs=[TabInfo(url='https://example.com', title='Page 1', page_id=1)],
screenshot='screenshot1.png',
items=[DomContentItem(index=1, text='Button', is_text_only=False, depth=0)],
selector_map={1: '//button[1]'},
@@ -102,8 +100,7 @@ def sample_history(action_registry):
state=BrowserState(
url='https://example.com/page2',
title='Page 2',
- current_tab_handle='tab1',
- tabs=[TabInfo(handle='tab1', url='https://example.com/page2', title='Page 2')],
+ tabs=[TabInfo(url='https://example.com/page2', title='Page 2', page_id=2)],
screenshot='screenshot2.png',
items=[DomContentItem(index=2, text='Content', is_text_only=True, depth=0)],
selector_map={2: '//div[1]'},
@@ -122,8 +119,7 @@ def sample_history(action_registry):
state=BrowserState(
url='https://example.com/page2',
title='Page 2',
- current_tab_handle='tab1',
- tabs=[TabInfo(handle='tab1', url='https://example.com/page2', title='Page 2')],
+ tabs=[TabInfo(url='https://example.com/page2', title='Page 2', page_id=2)],
screenshot='screenshot3.png',
items=[DomContentItem(index=3, text='Final', is_text_only=True, depth=0)],
selector_map={3: '//div[2]'},