Skip to content

0.2.1

Choose a tag to compare

@pirate pirate released this 23 May 10:04
· 7717 commits to main since this release
27ca169

What's Changed

Tip

☁️ Browser-Use Cloud also now supports Webhooks! We've made it easy to wire up Browser-Use to other systems.


🔎 Element detection, page interaction, and LLM model support improvements

We've added several new methods of detecting elements on pages and refined the existing ones. We've also added support for more models and vector store providers for memory. Debug and info logging is also significantly improved in general.


🎭 Browsers are now much simpler to set up: just BrowserProfile + BrowserSession

https://docs.browser-use.com/customize/browser-settings
https://docs.browser-use.com/customize/real-browser

You can also now pass in existing Playwright (or Patchright!) Page, BrowserContext, and/or Browser objects.

agent = Agent(task='fill out this form', llm=llm, page=page)
Replaces: Browser, BrowserConfig, BrowserContext, BrowserContextConfig. See more...
from browser_use import BrowserProfile, BrowserSession, Agent

async def main():
    browser_profile = BrowserProfile(
        is_mobile=True,
        window_size={'width': 460, 'height': 720},
        # ✨ all standard playwright launch_persistent_context() args are now supported here...,
        # all config from old BrowserConfig(), BrowserContextConfig() objects is also supported...
     )
    
    browser_session = BrowserSession(
        # cdp_url: str,                                                       # connect to a remote browser
        # browser: Browser | BrowserContext | Page,   # ✨ can now use existing playwright browser objects
        # or launch a new local browser with a given profile/user_data_dir/binary:
        browser_profile: BrowserProfile,
        # user_data_dir: Path='~/.config/browseruse/profiles/default',
        # executable_path: Path,
        # headless: bool=False,
        # playwright=await async_patchright().start(),  # optional: use patchright instead of playwright for stealth
        # ... any BrowserProfile kwargs can also go here as overrides ...
        allowed_domains=['https://*.google.com', 'chrome-extension://*', '*.example.com'],  # ✨ can now enforce the scheme too
    )
    agent = Agent(task="find today's DOW stock price", browser_session=browser_session)  # or page=page, ...
    await agent.run()

See an example of going back-and-forth with another tool sharing a single browser: examples/integrations/stagehand_back_and_forth.py

📄 Actions functions now get the playwright Page object directly

Custom actions can now ask for the playwright page or browser_session parameters:

from patchright.async_api import Page
from browser_use import Controller, Registry 

controller = Controller

@controller.registry.action(description='Some custom Google sheets action', allowed_domains=['https://docs.google.com'])
async def setup_spreadsheet_graph(cell_range: str, page: Page):   # <-- 🎭 use page to get a normal playwright Page object
	# page = await browser.get_current_page()  # <--- extra call no longer needed to get current page
	await page.evaluate("""() => { 
        // define the wiggle animation
        document.styleSheets[0].insertRule('@keyframes wiggle { 0% { transform: rotate(0deg); } 50% { transform: rotate(10deg); } 100% { transform: rotate(0deg); } }');
        
        document.querySelectorAll("*").forEach(element => {
            element.style.animation = "wiggle 0.5s infinite";
        });
    }""")

🔒 Significant security improvements

https://docs.browser-use.com/customize/sensitive-data#domain-specific-sensitive-data
https://docs.browser-use.com/customize/browser-settings#:~:text=same%20browser%20instance.-,allowed_domains

  • local browsers now all start with a dedicated empty profile that persists between runs in ~/.config/browseruse/profiles/default
    • will now refuse to start with default profile in order to avoid security risks of exposing too many cookies unintentionally
    • browser-use default profile is stored under ~/.config and can be easily set up with only the cookies the bot needs for its tasks
  • Agent(sensitive_data) now expects a new format {domain: {key, val, ...}} instead of {key: value, ...}, the new format restricts credentials on a per-domain basis. The domain uses the same matching system as allowed_domains so it supports globs and scheme checking too: http*://*.example.com
  • BrowserSession(allowed_domains=[...]) now defaults to enforcing https:// unless http:// or http*:// is explicitly included
  • #1750

  • Code cleanup for cleanup_httpx_clients function call by @ajuijas in #1692
  • Fix: detect nested interactive elements using heuristics to avoid skipping actionable items by @s00d in #1660
  • Fix revalidation of user-provided MemoryConfig() by @pirate in #1696
  • fixed scroll when whole page lives inside a nested container by @Guido1Alessandro1Trevisan in #1703
  • fix:using f-string to refer outer variable, fix glob WARNING log in allowed_domains by @limingzhong61 in #1709
  • Support multi-thread agent execution including pause,resume operations by @dharam1291 in #1466
  • fix: detect interactive elements with click event listener by @limingzhong61 in #1706
  • Refactor Browser, BrowserConfig, & BrowserContextConfig into simpler BrowserProfile & BrowserSession by @pirate in #1699
  • Fixed the issue where getEventListeners was unavailable when used in page.evaluate. Changed to a custom event listener detection approach. by @shawyang0304 in #1710
  • Refactor advanced_search.py to use SERP API for web search and improv… by @MagMueller in #1725
  • Hot fix/agent does not stop by @MagMueller in #1727
  • Example/simple by @MagMueller in #1724
  • Hot fix/browser profile is none by @MagMueller in #1723
  • Enhancement/logger by @MagMueller in #1730
  • Add browser-use rules documentation by @MagMueller in #1732
  • Update browser-use rules documentation to enhance clarity and usage i… by @MagMueller in #1733
  • Update docs with webhooks by @LarsenCundric in #1736
  • Add new page by @LarsenCundric in #1739
  • Remove redundant URL assertions in BrowserSession class for cleaner c… by @MagMueller in #1731
  • Enhancement/accessibility tree by @MagMueller in #1749
  • Stricter security for allowed_domains *. glob logic, and allow enforcing scheme as well as domain: https://domain, better logging, new loading animation by @pirate in #1750
  • Add Stagehand + Browser-Use example, sharing the same browser by @pirate in #1756
  • Fix Bugs - Null Checking, API Changes, Conditional Logics by @yasithdev in #1720
  • Increase range of vector store providers for memory by @EnzoFanAccount in #1729

New Contributors

Full Changelog: 0.1.48...0.2.1