repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/dom_watchdog.py
browser_use/browser/watchdogs/dom_watchdog.py
"""DOM watchdog for browser DOM tree management using CDP.""" import asyncio import time from typing import TYPE_CHECKING from browser_use.browser.events import ( BrowserErrorEvent, BrowserStateRequestEvent, ScreenshotEvent, TabCreatedEvent, ) from browser_use.browser.watchdog_base import BaseWatchdog from browse...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/recording_watchdog.py
browser_use/browser/watchdogs/recording_watchdog.py
"""Recording Watchdog for Browser Use Sessions.""" import asyncio from pathlib import Path from typing import ClassVar from bubus import BaseEvent from cdp_use.cdp.page.events import ScreencastFrameEvent from uuid_extensions import uuid7str from browser_use.browser.events import BrowserConnectedEvent, BrowserStopEve...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/downloads_watchdog.py
browser_use/browser/watchdogs/downloads_watchdog.py
"""Downloads watchdog for monitoring and handling file downloads.""" import asyncio import json import os import tempfile from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar from urllib.parse import urlparse import anyio from bubus import BaseEvent from cdp_use.cdp.browser import DownloadProgress...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/permissions_watchdog.py
browser_use/browser/watchdogs/permissions_watchdog.py
"""Permissions watchdog for granting browser permissions on connection.""" from typing import TYPE_CHECKING, ClassVar from bubus import BaseEvent from browser_use.browser.events import BrowserConnectedEvent from browser_use.browser.watchdog_base import BaseWatchdog if TYPE_CHECKING: pass class PermissionsWatchdo...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/screenshot_watchdog.py
browser_use/browser/watchdogs/screenshot_watchdog.py
"""Screenshot watchdog for handling screenshot requests using CDP.""" from typing import TYPE_CHECKING, Any, ClassVar from bubus import BaseEvent from cdp_use.cdp.page import CaptureScreenshotParameters from browser_use.browser.events import ScreenshotEvent from browser_use.browser.views import BrowserError from bro...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/aboutblank_watchdog.py
browser_use/browser/watchdogs/aboutblank_watchdog.py
"""About:blank watchdog for managing about:blank tabs with DVD screensaver.""" from typing import TYPE_CHECKING, ClassVar from bubus import BaseEvent from cdp_use.cdp.target import TargetID from pydantic import PrivateAttr from browser_use.browser.events import ( AboutBlankDVDScreensaverShownEvent, BrowserStopEven...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/local_browser_watchdog.py
browser_use/browser/watchdogs/local_browser_watchdog.py
"""Local browser watchdog for managing browser subprocess lifecycle.""" import asyncio import os import shutil import tempfile from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar import psutil from bubus import BaseEvent from pydantic import PrivateAttr from browser_use.browser.events import ( ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/storage_state_watchdog.py
browser_use/browser/watchdogs/storage_state_watchdog.py
"""Storage state watchdog for managing browser cookies and storage persistence.""" import asyncio import json import os from pathlib import Path from typing import Any, ClassVar from bubus import BaseEvent from cdp_use.cdp.network import Cookie from pydantic import Field, PrivateAttr from browser_use.browser.events ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/security_watchdog.py
browser_use/browser/watchdogs/security_watchdog.py
"""Security watchdog for enforcing URL access policies.""" from typing import TYPE_CHECKING, ClassVar from bubus import BaseEvent from browser_use.browser.events import ( BrowserErrorEvent, NavigateToUrlEvent, NavigationCompleteEvent, TabCreatedEvent, ) from browser_use.browser.watchdog_base import BaseWatchdog ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/default_action_watchdog.py
browser_use/browser/watchdogs/default_action_watchdog.py
"""Default browser action handlers using CDP.""" import asyncio import json from cdp_use.cdp.input.commands import DispatchKeyEventParameters from browser_use.actor.utils import get_key_info from browser_use.browser.events import ( ClickCoordinateEvent, ClickElementEvent, GetDropdownOptionsEvent, GoBackEvent, G...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/__init__.py
browser_use/browser/watchdogs/__init__.py
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/crash_watchdog.py
browser_use/browser/watchdogs/crash_watchdog.py
"""Browser watchdog for monitoring crashes and network timeouts using CDP.""" import asyncio import time from typing import TYPE_CHECKING, ClassVar import psutil from bubus import BaseEvent from cdp_use.cdp.target import SessionID, TargetID from cdp_use.cdp.target.events import TargetCrashedEvent from pydantic import...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/watchdogs/popups_watchdog.py
browser_use/browser/watchdogs/popups_watchdog.py
"""Watchdog for handling JavaScript dialogs (alert, confirm, prompt) automatically.""" import asyncio from typing import ClassVar from bubus import BaseEvent from pydantic import PrivateAttr from browser_use.browser.events import TabCreatedEvent from browser_use.browser.watchdog_base import BaseWatchdog class Popu...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/cloud/views.py
browser_use/browser/cloud/views.py
from typing import Literal from uuid import UUID from pydantic import BaseModel, ConfigDict, Field ProxyCountryCode = ( Literal[ 'us', # United States 'uk', # United Kingdom 'fr', # France 'it', # Italy 'jp', # Japan 'au', # Australia 'de', # Germany 'fi', # Finland 'ca', # Canada 'in', ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/browser/cloud/cloud.py
browser_use/browser/cloud/cloud.py
"""Cloud browser service integration for browser-use. This module provides integration with the browser-use cloud browser service. When cloud_browser=True, it automatically creates a cloud browser instance and returns the CDP URL for connection. """ import logging import os import httpx from browser_use.browser.clo...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/prompts.py
browser_use/agent/prompts.py
import importlib.resources from datetime import datetime from typing import TYPE_CHECKING, Literal, Optional from browser_use.dom.views import NodeType, SimplifiedNode from browser_use.llm.messages import ContentPartImageParam, ContentPartTextParam, ImageURL, SystemMessage, UserMessage from browser_use.observability i...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/views.py
browser_use/agent/views.py
from __future__ import annotations import json import logging import traceback from dataclasses import dataclass from pathlib import Path from typing import Any, Generic, Literal from pydantic import BaseModel, ConfigDict, Field, ValidationError, create_model, model_validator from typing_extensions import TypeVar fro...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/gif.py
browser_use/agent/gif.py
from __future__ import annotations import base64 import io import logging import os import platform from typing import TYPE_CHECKING from browser_use.agent.views import AgentHistoryList from browser_use.browser.views import PLACEHOLDER_4PX_SCREENSHOT from browser_use.config import CONFIG if TYPE_CHECKING: from PIL ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/judge.py
browser_use/agent/judge.py
"""Judge system for evaluating browser-use agent execution traces.""" import base64 import logging from pathlib import Path from browser_use.llm.messages import ( BaseMessage, ContentPartImageParam, ContentPartTextParam, ImageURL, SystemMessage, UserMessage, ) logger = logging.getLogger(__name__) def _encode...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/service.py
browser_use/agent/service.py
import asyncio import gc import inspect import json import logging import re import tempfile import time from collections.abc import Awaitable, Callable from pathlib import Path from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, cast from urllib.parse import urlparse if TYPE_CHECKING: from browser_use....
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/cloud_events.py
browser_use/agent/cloud_events.py
import base64 import os from datetime import datetime, timezone from pathlib import Path import anyio from bubus import BaseEvent from pydantic import Field, field_validator from uuid_extensions import uuid7str MAX_STRING_LENGTH = 100000 # 100K chars ~ 25k tokens should be enough MAX_URL_LENGTH = 100000 MAX_TASK_LEN...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/variable_detector.py
browser_use/agent/variable_detector.py
"""Detect variables in agent history for reuse""" import re from browser_use.agent.views import AgentHistoryList, DetectedVariable from browser_use.dom.views import DOMInteractedElement def detect_variables_in_history(history: AgentHistoryList) -> dict[str, DetectedVariable]: """ Analyze agent history and detect ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/message_manager/views.py
browser_use/agent/message_manager/views.py
from __future__ import annotations from typing import TYPE_CHECKING, Any from pydantic import BaseModel, ConfigDict, Field from browser_use.llm.messages import ( BaseMessage, ) if TYPE_CHECKING: pass class HistoryItem(BaseModel): """Represents a single agent history item with its data and string representation...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/message_manager/service.py
browser_use/agent/message_manager/service.py
from __future__ import annotations import logging from typing import Literal from browser_use.agent.message_manager.views import ( HistoryItem, ) from browser_use.agent.prompts import AgentMessagePrompt from browser_use.agent.views import ( ActionResult, AgentOutput, AgentStepInfo, MessageManagerState, ) from br...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/message_manager/utils.py
browser_use/agent/message_manager/utils.py
from __future__ import annotations import json import logging from pathlib import Path from typing import Any import anyio from browser_use.llm.messages import BaseMessage logger = logging.getLogger(__name__) async def save_conversation( input_messages: list[BaseMessage], response: Any, target: str | Path, en...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/agent/system_prompts/__init__.py
browser_use/agent/system_prompts/__init__.py
# System prompt templates for browser-use agent
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/telemetry/views.py
browser_use/telemetry/views.py
from abc import ABC, abstractmethod from collections.abc import Sequence from dataclasses import asdict, dataclass from typing import Any, Literal from browser_use.config import is_running_in_docker @dataclass class BaseTelemetryEvent(ABC): @property @abstractmethod def name(self) -> str: pass @property def ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/telemetry/service.py
browser_use/telemetry/service.py
import logging import os from dotenv import load_dotenv from posthog import Posthog from uuid_extensions import uuid7str from browser_use.telemetry.views import BaseTelemetryEvent from browser_use.utils import singleton load_dotenv() from browser_use.config import CONFIG logger = logging.getLogger(__name__) POST...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/telemetry/__init__.py
browser_use/telemetry/__init__.py
""" Telemetry for Browser Use. """ from typing import TYPE_CHECKING # Type stubs for lazy imports if TYPE_CHECKING: from browser_use.telemetry.service import ProductTelemetry from browser_use.telemetry.views import ( BaseTelemetryEvent, CLITelemetryEvent, MCPClientTelemetryEvent, MCPServerTelemetryEvent, )...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/mouse.py
browser_use/actor/mouse.py
"""Mouse class for mouse operations.""" from typing import TYPE_CHECKING if TYPE_CHECKING: from cdp_use.cdp.input.commands import DispatchMouseEventParameters, SynthesizeScrollGestureParameters from cdp_use.cdp.input.types import MouseButton from browser_use.browser.session import BrowserSession class Mouse: "...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/element.py
browser_use/actor/element.py
"""Element class for element operations.""" import asyncio from typing import TYPE_CHECKING, Literal, Union from cdp_use.client import logger from typing_extensions import TypedDict if TYPE_CHECKING: from cdp_use.cdp.dom.commands import ( DescribeNodeParameters, FocusParameters, GetAttributesParameters, Get...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/utils.py
browser_use/actor/utils.py
"""Utility functions for actor operations.""" class Utils: """Utility functions for actor operations.""" @staticmethod def get_key_info(key: str) -> tuple[str, int | None]: """Get the code and windowsVirtualKeyCode for a key. Args: key: Key name (e.g., 'Enter', 'ArrowUp', 'a', 'A') Returns: Tuple of...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/__init__.py
browser_use/actor/__init__.py
"""CDP-Use High-Level Library A Playwright-like library built on top of CDP (Chrome DevTools Protocol). """ from .element import Element from .mouse import Mouse from .page import Page from .utils import Utils __all__ = ['Page', 'Element', 'Mouse', 'Utils']
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/page.py
browser_use/actor/page.py
"""Page class for page-level operations.""" from typing import TYPE_CHECKING, TypeVar from pydantic import BaseModel from browser_use import logger from browser_use.actor.utils import get_key_info from browser_use.dom.serializer.serializer import DOMTreeSerializer from browser_use.dom.service import DomService from ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/playground/playground.py
browser_use/actor/playground/playground.py
#!/usr/bin/env python3 """ Playground script to test the browser-use actor API. This script demonstrates: - Starting a browser session - Using the actor API to navigate and interact - Finding elements, clicking, scrolling, JavaScript evaluation - Testing most of the available methods """ import asyncio import json im...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/playground/flights.py
browser_use/actor/playground/flights.py
import asyncio from browser_use import Agent, Browser, ChatOpenAI llm = ChatOpenAI('gpt-4.1-mini') async def main(): """ Main function demonstrating mixed automation with Browser-Use and Playwright. """ print('🚀 Mixed Automation with Browser-Use and Actor API') browser = Browser(keep_alive=True) await brows...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/actor/playground/mixed_automation.py
browser_use/actor/playground/mixed_automation.py
import asyncio from pydantic import BaseModel from browser_use import Browser, ChatOpenAI TASK = """ On the current wikipedia page, find the latest huge edit and tell me what is was about. """ class LatestEditFinder(BaseModel): """Find the latest huge edit on the current wikipedia page.""" latest_edit: str edi...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/mcp/controller.py
browser_use/mcp/controller.py
"""MCP (Model Context Protocol) tool wrapper for browser-use. This module provides integration between MCP tools and browser-use's action registry system. MCP tools are dynamically discovered and registered as browser-use actions. """ import asyncio import logging from typing import Any from pydantic import Field, c...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/mcp/client.py
browser_use/mcp/client.py
"""MCP (Model Context Protocol) client integration for browser-use. This module provides integration between external MCP servers and browser-use's action registry. MCP tools are dynamically discovered and registered as browser-use actions. Example usage: from browser_use import Tools from browser_use.mcp.cli...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/mcp/__main__.py
browser_use/mcp/__main__.py
"""Entry point for running MCP server as a module. Usage: python -m browser_use.mcp """ import asyncio from browser_use.mcp.server import main if __name__ == '__main__': asyncio.run(main())
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/mcp/__init__.py
browser_use/mcp/__init__.py
"""MCP (Model Context Protocol) support for browser-use. This module provides integration with MCP servers and clients for browser automation. """ from browser_use.mcp.client import MCPClient from browser_use.mcp.controller import MCPToolWrapper __all__ = ['MCPClient', 'MCPToolWrapper', 'BrowserUseServer'] # type: ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/mcp/server.py
browser_use/mcp/server.py
"""MCP Server for browser-use - exposes browser automation capabilities via Model Context Protocol. This server provides tools for: - Running autonomous browser tasks with an AI agent - Direct browser control (navigation, clicking, typing, etc.) - Content extraction from web pages - File system operations Usage: ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/sync/service.py
browser_use/sync/service.py
""" Cloud sync service for sending events to the Browser Use cloud. """ import logging import httpx from bubus import BaseEvent from browser_use.config import CONFIG from browser_use.sync.auth import TEMP_USER_ID, DeviceAuthClient logger = logging.getLogger(__name__) class CloudSync: """Service for syncing event...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/sync/__init__.py
browser_use/sync/__init__.py
"""Cloud sync module for Browser Use.""" from browser_use.sync.auth import CloudAuthConfig, DeviceAuthClient from browser_use.sync.service import CloudSync __all__ = ['CloudAuthConfig', 'DeviceAuthClient', 'CloudSync']
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/sync/auth.py
browser_use/sync/auth.py
""" OAuth2 Device Authorization Grant flow client for browser-use. """ import asyncio import json import os import shutil import time from datetime import datetime import httpx from pydantic import BaseModel from uuid_extensions import uuid7str from browser_use.config import CONFIG # Temporary user ID for pre-auth ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/screenshots/service.py
browser_use/screenshots/service.py
""" Screenshot storage service for browser-use agents. """ import base64 from pathlib import Path import anyio from browser_use.observability import observe_debug class ScreenshotService: """Simple screenshot storage service that saves screenshots to disk""" def __init__(self, agent_directory: str | Path): ""...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/browser_use/screenshots/__init__.py
browser_use/screenshots/__init__.py
# Screenshots package for browser-use
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/scripts/debug_iframe_scrolling.py
tests/scripts/debug_iframe_scrolling.py
""" Debug test for iframe scrolling issue where DOM tree only shows top elements after scrolling. This test verifies that after scrolling inside an iframe, the selector_map correctly contains lower input elements like City, State, Zip Code, etc. """ import asyncio import sys from pathlib import Path # Add parent dir...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/scripts/test_frame_hierarchy.py
tests/scripts/test_frame_hierarchy.py
#!/usr/bin/env python3 """Test frame hierarchy for any URL passed as argument.""" import asyncio import sys from browser_use.browser import BrowserSession from browser_use.browser.events import BrowserStartEvent from browser_use.browser.profile import BrowserProfile async def analyze_frame_hierarchy(url): """Analy...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_screenshot_exclusion.py
tests/ci/test_screenshot_exclusion.py
"""Test that screenshot action is excluded when use_vision != 'auto'.""" import pytest from browser_use.agent.service import Agent from browser_use.browser.profile import BrowserProfile from browser_use.browser.session import BrowserSession from browser_use.tools.service import Tools from tests.ci.conftest import cre...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/evaluate_tasks.py
tests/ci/evaluate_tasks.py
""" Runs all agent tasks in parallel (up to 10 at a time) using separate subprocesses. Each task gets its own Python process, preventing browser session interference. Fails with exit code 1 if 0% of tasks pass. """ import argparse import asyncio import glob import json import logging import os import sys import warnin...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_rerun_ai_summary.py
tests/ci/test_rerun_ai_summary.py
"""Tests for AI summary generation during rerun""" from unittest.mock import AsyncMock from browser_use.agent.service import Agent from browser_use.agent.views import ActionResult, AgentHistory, AgentHistoryList, RerunSummaryAction, StepMetadata from browser_use.browser.views import BrowserStateHistory from browser_u...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_file_system_llm_integration.py
tests/ci/test_file_system_llm_integration.py
"""Integration tests for DOCX and image file support in LLM messages.""" import base64 import io from pathlib import Path import pytest from PIL import Image from browser_use.agent.message_manager.service import MessageManager from browser_use.agent.prompts import AgentMessagePrompt from browser_use.agent.views impo...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_markdown_extractor.py
tests/ci/test_markdown_extractor.py
"""Tests for markdown extractor preprocessing.""" from browser_use.dom.markdown_extractor import _preprocess_markdown_content class TestPreprocessMarkdownContent: """Tests for _preprocess_markdown_content function.""" def test_preserves_short_lines(self): """Short lines (1-2 chars) should be preserved, not remo...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_tools.py
tests/ci/test_tools.py
import asyncio import tempfile import time import pytest from pydantic import BaseModel from pytest_httpserver import HTTPServer from browser_use.agent.views import ActionResult from browser_use.browser import BrowserSession from browser_use.browser.profile import BrowserProfile from browser_use.filesystem.file_syste...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_extension_config.py
tests/ci/test_extension_config.py
"""Tests for extension configuration environment variables.""" import os import pytest class TestDisableExtensionsEnvVar: """Test BROWSER_USE_DISABLE_EXTENSIONS environment variable.""" def test_default_value_is_true(self): """Without env var set, enable_default_extensions should default to True.""" # Clear ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_file_system_docx.py
tests/ci/test_file_system_docx.py
"""Tests for DOCX file support in the FileSystem.""" from pathlib import Path import pytest from browser_use.filesystem.file_system import ( DocxFile, FileSystem, ) class TestDocxFile: """Test DOCX file operations.""" @pytest.mark.asyncio async def test_create_docx_file(self, tmp_path: Path): """Test creat...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_sandbox_structured_output.py
tests/ci/test_sandbox_structured_output.py
""" Tests for sandbox structured output handling. Tests that output_model_schema works correctly when using @sandbox decorator, specifically that the _output_model_schema private attribute is preserved through serialization/deserialization. """ from pydantic import BaseModel from browser_use.agent.views import Actio...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_ai_step.py
tests/ci/test_ai_step.py
"""Tests for AI step private method used during rerun""" from unittest.mock import AsyncMock from browser_use.agent.service import Agent from browser_use.agent.views import ActionResult from tests.ci.conftest import create_mock_llm async def test_execute_ai_step_basic(): """Test that _execute_ai_step extracts cont...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_history_wait_time.py
tests/ci/test_history_wait_time.py
from browser_use.agent.views import StepMetadata def test_step_metadata_has_step_interval_field(): """Test that StepMetadata includes step_interval field""" metadata = StepMetadata(step_number=1, step_start_time=10.0, step_end_time=12.5, step_interval=2.5) assert hasattr(metadata, 'step_interval') assert metadat...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_coordinate_clicking.py
tests/ci/test_coordinate_clicking.py
"""Tests for coordinate clicking feature. This feature allows certain models (Claude Sonnet 4, Claude Opus 4, Gemini 3 Pro, browser-use/* models) to use coordinate-based clicking, while other models only get index-based clicking. """ import pytest from browser_use.tools.service import Tools from browser_use.tools.vi...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/conftest.py
tests/ci/conftest.py
""" Pytest configuration for browser-use CI tests. Sets up environment variables to ensure tests never connect to production services. """ import os import socketserver import tempfile from unittest.mock import AsyncMock import pytest from dotenv import load_dotenv from pytest_httpserver import HTTPServer # Fix for...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_file_system_images.py
tests/ci/test_file_system_images.py
"""Tests for image file support in the FileSystem.""" import base64 import io from pathlib import Path import pytest from PIL import Image from browser_use.filesystem.file_system import FileSystem class TestImageFiles: """Test image file operations - only external reading supported.""" def create_test_image(sel...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_variable_substitution.py
tests/ci/test_variable_substitution.py
"""Unit tests for variable substitution in agent history""" from types import SimpleNamespace from browser_use.agent.service import Agent from browser_use.dom.views import DOMInteractedElement, NodeType def create_test_element(attributes: dict[str, str] | None = None) -> DOMInteractedElement: """Helper to create a...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_fallback_llm.py
tests/ci/test_fallback_llm.py
""" Tests for the fallback_llm feature in Agent. Tests verify that when the primary LLM fails with rate limit (429) or server errors (503, 502, 500, 504), the agent automatically switches to the fallback LLM and continues execution. """ from unittest.mock import AsyncMock import pytest from browser_use.agent.views ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_variable_detection.py
tests/ci/test_variable_detection.py
"""Unit tests for variable detection in agent history""" from browser_use.agent.variable_detector import ( _detect_from_attributes, _detect_from_value_pattern, _detect_variable_type, _ensure_unique_name, detect_variables_in_history, ) from browser_use.agent.views import DetectedVariable from browser_use.dom.views...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/test_llm_retries.py
tests/ci/test_llm_retries.py
""" Test retry logic with exponential backoff for LLM clients. """ import time from unittest.mock import AsyncMock, MagicMock, patch import httpx import pytest class TestChatBrowserUseRetries: """Test retry logic for ChatBrowserUse.""" @pytest.fixture def mock_env(self, monkeypatch): """Set up environment for...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_config.py
tests/ci/infrastructure/test_config.py
"""Tests for lazy loading configuration system.""" import os from browser_use.config import CONFIG class TestLazyConfig: """Test lazy loading of environment variables through CONFIG object.""" def test_config_reads_env_vars_lazily(self): """Test that CONFIG reads environment variables each time they're accesse...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_filesystem.py
tests/ci/infrastructure/test_filesystem.py
"""Tests for the FileSystem class and related file operations.""" import asyncio import tempfile from pathlib import Path import pytest from browser_use.filesystem.file_system import ( DEFAULT_FILE_SYSTEM_PATH, INVALID_FILENAME_ERROR_MESSAGE, CsvFile, FileSystem, FileSystemState, JsonFile, JsonlFile, Markdow...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
true
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_registry_core.py
tests/ci/infrastructure/test_registry_core.py
""" Comprehensive tests for the action registry system - Core functionality. Tests cover: 1. Existing parameter patterns (individual params, pydantic models) 2. Special parameter injection (browser_session, page_extraction_llm, etc.) 3. Action-to-action calling scenarios 4. Mixed parameter patterns 5. Registry executi...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_registry_action_parameter_injection.py
tests/ci/infrastructure/test_registry_action_parameter_injection.py
import asyncio import base64 import socketserver import pytest from pytest_httpserver import HTTPServer from browser_use.browser import BrowserProfile, BrowserSession # Fix for httpserver hanging on shutdown - prevent blocking on socket close socketserver.ThreadingMixIn.block_on_close = False socketserver.ThreadingM...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_url_shortening.py
tests/ci/infrastructure/test_url_shortening.py
""" Simplified tests for URL shortening functionality in Agent service. Three focused tests: 1. Input message processing with URL shortening 2. Output processing with custom actions and URL restoration 3. End-to-end pipeline test """ import json import pytest from browser_use.agent.service import Agent from browser...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/infrastructure/test_registry_validation.py
tests/ci/infrastructure/test_registry_validation.py
""" Comprehensive tests for the action registry system - Validation and patterns. Tests cover: 1. Type 1 and Type 2 patterns 2. Validation rules 3. Decorated function behavior 4. Parameter model generation 5. Parameter ordering """ import asyncio import logging import pytest from pydantic import Field from browser_...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_openai.py
tests/ci/models/test_llm_openai.py
"""Test OpenAI model button click.""" from browser_use.llm.openai.chat import ChatOpenAI from tests.ci.models.model_test_helper import run_model_button_click_test async def test_openai_gpt_4_1_mini(httpserver): """Test OpenAI gpt-4.1-mini can click a button.""" await run_model_button_click_test( model_class=Chat...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_anthropic.py
tests/ci/models/test_llm_anthropic.py
"""Test Anthropic model button click.""" from browser_use.llm.anthropic.chat import ChatAnthropic from tests.ci.models.model_test_helper import run_model_button_click_test async def test_anthropic_claude_sonnet_4_0(httpserver): """Test Anthropic claude-sonnet-4-0 can click a button.""" await run_model_button_click...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_google.py
tests/ci/models/test_llm_google.py
"""Test Google model button click.""" from browser_use.llm.google.chat import ChatGoogle from tests.ci.models.model_test_helper import run_model_button_click_test async def test_google_gemini_flash_latest(httpserver): """Test Google gemini-flash-latest can click a button.""" await run_model_button_click_test( mo...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_azure_responses_api.py
tests/ci/models/test_azure_responses_api.py
"""Tests for Azure OpenAI Responses API support.""" import os import pytest from browser_use.llm.azure.chat import RESPONSES_API_ONLY_MODELS, ChatAzureOpenAI from browser_use.llm.messages import ( AssistantMessage, ContentPartImageParam, ContentPartTextParam, Function, ImageURL, SystemMessage, ToolCall, User...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_schema_optimizer.py
tests/ci/models/test_llm_schema_optimizer.py
""" Tests for the SchemaOptimizer to ensure it correctly processes and optimizes the schemas for agent actions without losing information. """ from pydantic import BaseModel from browser_use.agent.views import AgentOutput from browser_use.llm.schema import SchemaOptimizer from browser_use.tools.service import Tools ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_azure.py
tests/ci/models/test_llm_azure.py
"""Test Azure OpenAI model button click.""" from browser_use.llm.azure.chat import ChatAzureOpenAI from tests.ci.models.model_test_helper import run_model_button_click_test async def test_azure_gpt_4_1_mini(httpserver): """Test Azure OpenAI gpt-4.1-mini can click a button.""" await run_model_button_click_test( m...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/test_llm_browseruse.py
tests/ci/models/test_llm_browseruse.py
"""Test Browser Use model button click.""" from browser_use.llm.browser_use.chat import ChatBrowserUse from tests.ci.models.model_test_helper import run_model_button_click_test async def test_browseruse_bu_latest(httpserver): """Test Browser Use bu-latest can click a button.""" await run_model_button_click_test( ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/models/model_test_helper.py
tests/ci/models/model_test_helper.py
"""Shared test helper for LLM model tests.""" import os import pytest from browser_use.agent.service import Agent from browser_use.browser.profile import BrowserProfile from browser_use.browser.session import BrowserSession async def run_model_button_click_test( model_class, model_name: str, api_key_env: str | ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/security/test_security_flags.py
tests/ci/security/test_security_flags.py
"""Test that disable_security flag properly merges --disable-features flags without breaking extensions.""" import tempfile from browser_use.browser.profile import BrowserProfile class TestBrowserProfileDisableSecurity: """Test disable_security flag behavior.""" def test_disable_security_preserves_extension_feat...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/security/test_sensitive_data.py
tests/ci/security/test_sensitive_data.py
import pytest from pydantic import BaseModel, Field from browser_use.agent.message_manager.service import MessageManager from browser_use.agent.views import ActionResult, AgentOutput, AgentStepInfo, MessageManagerState from browser_use.browser.views import BrowserStateSummary from browser_use.dom.views import Serializ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/security/test_domain_filtering.py
tests/ci/security/test_domain_filtering.py
from browser_use.browser import BrowserProfile, BrowserSession class TestUrlAllowlistSecurity: """Tests for URL allowlist security bypass prevention and URL allowlist glob pattern matching.""" def test_authentication_bypass_prevention(self): """Test that the URL allowlist cannot be bypassed using authentication ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/security/test_ip_blocking.py
tests/ci/security/test_ip_blocking.py
""" Comprehensive tests for IP address blocking in SecurityWatchdog. Tests cover IPv4, IPv6, localhost, private networks, edge cases, and interactions with allowed_domains and prohibited_domains configurations. """ from bubus import EventBus from browser_use.browser import BrowserProfile, BrowserSession from browser...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_cloud_browser.py
tests/ci/browser/test_cloud_browser.py
"""Tests for cloud browser functionality.""" import tempfile from pathlib import Path from unittest.mock import AsyncMock, patch import pytest from browser_use.browser.cloud.cloud import ( CloudBrowserAuthError, CloudBrowserClient, CloudBrowserError, ) from browser_use.browser.cloud.views import CreateBrowserRequ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_tabs.py
tests/ci/browser/test_tabs.py
""" Test multi-tab operations: creation, switching, closing, and background tabs. Tests verify that: 1. Agent can create multiple tabs (3) and switch between them 2. Agent can close tabs with vision=True 3. Agent can handle buttons that open new tabs in background 4. Agent can continue and call done() after each tab o...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_dom_serializer.py
tests/ci/browser/test_dom_serializer.py
""" Test DOM serializer with complex scenarios: shadow DOM, same-origin and cross-origin iframes. This test verifies that the DOM serializer correctly: 1. Extracts interactive elements from shadow DOM 2. Processes same-origin iframes 3. Handles cross-origin iframes (should be blocked) 4. Generates correct selector_map...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_true_cross_origin_click.py
tests/ci/browser/test_true_cross_origin_click.py
"""Test clicking elements inside TRUE cross-origin iframes (external domains).""" import asyncio import pytest from browser_use.browser.profile import BrowserProfile, ViewportSize from browser_use.browser.session import BrowserSession from browser_use.tools.service import Tools @pytest.fixture async def browser_se...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_proxy.py
tests/ci/browser/test_proxy.py
import asyncio from typing import Any import pytest from browser_use.browser import BrowserProfile, BrowserSession from browser_use.browser.profile import ProxySettings from browser_use.config import CONFIG def test_chromium_args_include_proxy_flags(): profile = BrowserProfile( headless=True, user_data_dir=str...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_output_paths.py
tests/ci/browser/test_output_paths.py
"""Test all recording and save functionality for Agent and BrowserSession.""" from pathlib import Path import pytest from browser_use import Agent, AgentHistoryList from browser_use.browser import BrowserProfile, BrowserSession from tests.ci.conftest import create_mock_llm @pytest.fixture def test_dir(tmp_path): ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_cross_origin_click.py
tests/ci/browser/test_cross_origin_click.py
"""Test clicking elements inside cross-origin iframes.""" import asyncio import pytest from browser_use.browser.profile import BrowserProfile, ViewportSize from browser_use.browser.session import BrowserSession from browser_use.tools.service import Tools @pytest.fixture async def browser_session(): """Create brow...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_session_start.py
tests/ci/browser/test_session_start.py
""" Test script for BrowserSession.start() method to ensure proper initialization, concurrency handling, and error handling. Tests cover: - Calling .start() on a session that's already started - Simultaneously calling .start() from two parallel coroutines - Calling .start() on a session that's started but has a closed...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_navigation.py
tests/ci/browser/test_navigation.py
""" Test navigation edge cases: broken pages, slow loading, non-existing pages. Tests verify that: 1. Agent can handle navigation to broken/malformed HTML pages 2. Agent can handle slow-loading pages without hanging 3. Agent can handle non-existing pages (404, connection refused, etc.) 4. Agent can recover and continu...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_screenshot.py
tests/ci/browser/test_screenshot.py
import pytest from pytest_httpserver import HTTPServer from browser_use.agent.service import Agent from browser_use.browser.events import NavigateToUrlEvent from browser_use.browser.profile import BrowserProfile from browser_use.browser.session import BrowserSession from tests.ci.conftest import create_mock_llm @pyt...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/browser/test_cdp_headers.py
tests/ci/browser/test_cdp_headers.py
""" Test that headers are properly passed to CDPClient for authenticated remote browser connections. This tests the fix for: When using browser-use with remote browser services that require authentication headers, these headers need to be included in the WebSocket handshake. """ from unittest.mock import AsyncMock, M...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/interactions/test_radio_buttons.py
tests/ci/interactions/test_radio_buttons.py
# @file purpose: Test radio button interactions and serialization in browser-use """ Test file for verifying radio button clicking functionality and DOM serialization. This test creates a simple HTML page with radio buttons, sends an agent to click them, and logs the final agent message to show how radio buttons are r...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/interactions/test_dropdown_aria_menus.py
tests/ci/interactions/test_dropdown_aria_menus.py
import pytest from pytest_httpserver import HTTPServer from browser_use.agent.views import ActionResult from browser_use.browser import BrowserSession from browser_use.browser.profile import BrowserProfile from browser_use.tools.service import Tools @pytest.fixture(scope='session') def http_server(): """Create and ...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/tests/ci/interactions/test_dropdown_native.py
tests/ci/interactions/test_dropdown_native.py
"""Test GetDropdownOptionsEvent and SelectDropdownOptionEvent functionality. This file consolidates all tests related to dropdown functionality including: - Native <select> dropdowns - ARIA role="menu" dropdowns - Custom dropdown implementations """ import pytest from pytest_httpserver import HTTPServer from browser...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false
browser-use/browser-use
https://github.com/browser-use/browser-use/blob/630f85dd05127c9d42810a5db235a14f5bac9043/examples/simple.py
examples/simple.py
""" Setup: 1. Get your API key from https://cloud.browser-use.com/new-api-key 2. Set environment variable: export BROWSER_USE_API_KEY="your-key" """ from dotenv import load_dotenv from browser_use import Agent, ChatBrowserUse load_dotenv() agent = Agent( task='Find the number of stars of the following repos: brows...
python
MIT
630f85dd05127c9d42810a5db235a14f5bac9043
2026-01-04T14:38:16.467592Z
false