navigation-patterns
/navigation-patterns
Browser Use tab, session and back-navigation patterns, and login reuse via export/import. Use when opening or switching tabs, managing browser sessions, or reusing a login.
- Author
- madappgang ↗
- Repository
- magus ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 18
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Browser Use tab, session and back-navigation patterns, and login reuse via export/import. Use when opening or switching tabs, managing browser sessions, or reusing a login.
Original author description
Browser Use tab, session and back-navigation patterns, and login reuse via export/import. Use when opening or switching tabs, managing browser sessions, or reusing a login.
How it works
- 1. Basic Navigation
- 2. Back Navigation
- 3. Multi-Tab Workflows
- 4. Session Lifecycle Management
- 5. Login Persistence
- 6. Anti-Patterns
SKILL.md preview
---
name: navigation-patterns
description: Browser Use tab, session and back-navigation patterns, and login reuse via export/import. Use when opening or switching tabs, managing browser sessions, or reusing a login.
user-invocable: false
---
# Navigation Patterns
Patterns for URL navigation, multi-tab workflows, session lifecycle management, and keeping a login across sessions.
---
## 1. Basic Navigation
The fundamental browser pattern: navigate, inspect, interact, close.
```
Step 1: Navigate to URL (session created automatically)
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
mcp__plugin_browser-use_browser-use__browser_list_sessions()
→ record the new session's id (navigate itself returns only "Navigated to: …")
Step 2: Inspect the page
mcp__plugin_browser-use_browser-use__browser_get_state()
→ Returns interactive_elements, each with an index (the element's Chrome node id)
Step 3: Interact (optional)
mcp__plugin_browser-use_browser-use__browser_click(index=1834)
Step 4: Always close
mcp__plugin_browser-use_browser-use__browser_close_session(session_id="abc123")
```
**Verify page loaded**: `browser_navigate` returns only `Navigated to: <url>`, or an
`Error: navigation to <url> failed: …` line when the browser could not load it. It waits
up to 15 seconds for the document to finish loading. To see where you landed (a redirect,
a blank title), call `browser_get_state` and read its `url` and `title` before proceeding.
**Wait for dynamic content**: For SPAs (React, Vue, Angular), the DOM may not be ready immediately after navigate. If `interactive_elements` in `browser_get_state` is sparse or empty, call `browser_get_state` again after a short delay:
```
1. browser_navigate(url="https://spa-app.example.com")
2. browser_get_state() → sparse interactive_elements?
3. browser_get_state() → call again; SPA renders after first paint
```
---
## 2. Back Navigation
Use `browser_go_back` to return to the previous page without creating a new navigation entry.
```
Pattern: Visit detail page, then return to list
1. browser_navigate(url="https://shop.example.com/products") → then browser_list_sessions() for the id
2. browser_get_state() → find product links in interactive_elements
3. browser_click(index=5) → navigate to product detail
4. browser_extract_content(query="price and specs")
5. browser_go_back() → back to product list
6. browser_get_state() → the list page is a new document: new indices
7. browser_click(index=<next product's index from step 6>)
... repeat ...
N. browser_close_session(session_id)
```
**Note**: `browser_go_back` uses the tab's history stack. With no previous page (you
navigated straight to a deep URL, or the tab is new) it returns
`Error: there is no previous page in this tab's history.` Use `browser_navigate` with the
list URL instead.
---
## 3. Multi-Tab Workflows
Open multiple tabs within a single session to compare pages or extract data in parallel.
### 3.1 Open Link in New Tab
```
1. browser_navigate(url="https://example.com")
2. browser_navigate(url="https://example.com/page-2", new_tab=True)
3. browser_list_tabs()
→ [{"tab_id": "8B3E", "url": "https://example.com/", "title": "…"},
{"tab_id": "C41A", "url": "https://example.com/page-2", "title": "…"}]
```
`new_tab=True` returns `Opened new tab with URL: <url>`, and the page tools now act on
that new tab. A `tab_id` is the last 4 characters of the tab's id. If it matches more
than one tab, `browser_switch_tab` and `browser_close_tab` return an error listing the
full ids; pass more characters of the one you mean.
### 3.2 Switch Between Tabs
```
4. browser_switch_tab(tab_id="8B3E") → activate the first tab
5. browser_get_state() → DOM of that tab
6. browser_extract_content(query="pricing")
7. browser_switch_tab(tab_id="C41A") → activate the second tab
8. browser_extract_content(query="pricing")
```
### 3.3 Close Individual Tabs
```
9. browser_close_tab(tab_id="C41A") → close second tab
10. browser_close_session(session_id="<id recorded after step 1>") → close session (closes remaining tabs)
```
### Multi-Tab Use Cases
| Use Case | Pattern |
|----------|---------|
| Compare prices on two sites | Open site A → new_tab for site B → extract from each |
| Scrape paginated list into detail pages | Open list → each item in new tab → extract → close tab → next item |
| Compare before/after a UI change | Navigate to staging → new tab to production → screenshot both |
| Log in on one tab, use auth on another | Log in on the first tab, open the protected resource in a new tab (tabs in one session share cookies) |
---
## 4. Session Lifecycle Management
### 4.1 Session Creation
The first `browser_navigate` starts a session. It returns only `Navigated to: <url>`,
so read the id from `browser_list_sessions` straight after and record it:
```
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
mcp__plugin_browser-use_browser-use__browser_list_sessions()
→ [{"session_id": "5927ad6f594c497fa141e1beb2189883", "active": true, "age_minutes": 0.1, …}]
```
### 4.2 Session Inspection
List active sessions to detect leaks from previous runs or to resume a workflow:
```
mcp__plugin_browser-use_browser-use__browser_list_sessions()
→ [{"session_id": "abc123", "created_at": "...", "last_activity": "...", "active": true, "current_url": null, "age_minutes": 0.2}]
```
Record the `session_id` of every session this task opens. The list also shows sessions that other tasks, subagents or the user opened; they are not yours to close.
### 4.3 Session Cleanup
```
# Clean up a specific session
mcp__plugin_browser-use_browser-use__browser_close_session(session_id="abc123")
# Clean up every session THIS task opened (ids recorded when each was created)
for session_id in my_session_ids:
mcp__plugin_browser-use_browser-use__browser_close_session(session_id=session_id)
```
Never close a session you did not open. Another task or the user can hold one in the same
server, and closing it destroys their page state. A session left idle closes itself after
10 minutes (core-api, "Automatic cleanup").
### 4.4 Session Cleanup Decision Table
| Situation | Action |
|-----------|--------|
| Workflow completed successfully | `browser_close_session` |
| Workflow failed with an error | `browser_close_session` (still required) |
| Need to use the same session in the next step | Keep it open; the page tools act on it without an id |
| Starting a new unrelated task | close the sessions this task opened; open a new one |
| Debugging a stuck page | `browser_screenshot` first, then close |
---
## 5. Login Persistence
A session's Chrome profile is temporary: it is deleted when the session closes, including
by the 10-minute idle timeout (see core-api, "Automatic cleanup"). Login state survives
only as an exported JSON file, so export it the moment a login completes and import it to
skip the next login.
### 5.1 Where Exports Live
Pick any path for the export; `~/.browser-use/sessions/<site>.json` keeps them together.
### 5.2 Export Session for Reuse (After Login)
After completing a login workflow, export the session state to a JSON file:
```
# 1. Navigate and log in normally
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://github.com/login")
# ... complete login workflow (fill username, password, click submit) ...
# 2. Export the authenticated session
mcp__plugin_browser-use_browser-use__browser_export_session(
session_id="abc123",
output_path="~/.browser-use/sessions/github-session.json"
)
# 3. Close the session
mcp__plugin_browser-use_browser-use__browser_close_session(session_id="abc123")
```
### 5.3 Import Session (Skip Login)
In the next Claude Code session, restore the saved login state:
```
# Import saved cookies into a new session
mcp__plugin_browser-use_browser-use__browser_import_session(
import_path="~/.browser-use/sessions/github-session.json",
navigate_to="https://github.com/dashboard"
)
→ {"session_id": "new_xyz", "cookies_imported": 12, "original_url": "https://github.com/", "navigated_to": "https://github.com/dashboard", "is_primary": true}
# Verify login worked
mcp__plugin_browser-use_browser-use__browser_get_state()
# Check: interactive_elements should show dashboard elements, not login form
```
Import before any other browser starts. The page tools drive the imported session only
when none was active (`"is_primary": true`). With `"is_primary": false` they keep driving
the session that was already open: close both sessions, then import again.
### 5.4 Session Expiry Check
Saved sessions expire when site cookies expire. After importing, verify login succeeded:
```
1. browser_import_session(import_path="...", navigate_to="https://site.com/dashboard")
2. browser_get_state()
3. Check: if interactive_elements contains login form elements → session expired, login again
if interactive_elements contains dashboard elements → session active, proceed
```
---
## 6. Anti-Patterns
### Session Leaks
```
# WRONG: Forgot to close session
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
mcp__plugin_browser-use_browser-use__browser_extract_content(query="pricing")
# Task complete — session never closed. Browser process running, memory leaked.
# CORRECT: Always close
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
mcp__plugin_browser-use_browser-use__browser_extract_content(query="pricing")
mcp__plugin_browser-use_browser-use__browser_close_session(session_id="abc123")
```
### Stale Session IDs
```
# WRONG: closing or exporting with an id from a previous Claude Code session
mcp__plugin_browser-use_browser-use__browser_export_session(session_id="abc123", output_path="…")
# → "Session 'abc123' not found. Use browser_list_sessions to see active sessions."
# CORRECT: navigate first, then read the fresh id
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
mcp__plugin_browser-use_browser-use__browser_list_sessions()
```
### Tab Accumulation
```
# WRONG: Opening new tab in a loop without closing old ones
for each product_url:
browser_navigate(url=product_url, new_tab=True)
# 50 tabs open at once → browser crashes
# CORRECT: Close tab before opening next
for each product_url:
browser_navigate(url=product_url, new_tab=True)
tab_id = the browser_list_tabs() entry whose url is product_url
# ... extract data ...
browser_close_tab(tab_id=tab_id)
```
### Missing URL Scheme
```
# WRONG: URL without scheme
mcp__plugin_browser-use_browser-use__browser_navigate(url="example.com")
# → navigation error
# CORRECT: Always include https://
mcp__plugin_browser-use_browser-use__browser_navigate(url="https://example.com")
```
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · madappgang/magus | 100 | MIT |
| rshankras/claude-code-apple-skills | 100 | MIT |
| Owl-Listener/designer-skills | 90 | MIT |
Database snapshot: 13.11.2026 · package version 7e03120a9aa8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 5 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100browser-automation
Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts. - 100browser-automation
Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts. - 90codex-browser
Control an existing logged-in Chromium browser through the ChatGPT desktop app's browser extension. Use for browser tabs, navigation, DOM inspection, screenshots, input, network diagnostics, CDP, file upload, or browser-session debugging. - 96cloud-browser-sessions
Use when a headless agent needs a persistent-login browser. - 90remote-browser
Operate a remote/hosted browser session for agent automation when local browser tools are unavailable. Use for remote navigation, interaction, and observation. - 100using-claude-in-chrome
Use before controlling Chrome for anything that needs the user's real login session (a tool behind SSO, a Slack UI action, any cookie-gated page) and whenever another browser tool lands on a login page, returns an empty or anonymous-looking page, or seems to have lost a session…