Skip to content

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

switch back from patchright to playwright until issues are resolved

Nick Sweeting96682d8910c1
diff --git a/README.md b/README.md
index ce72d3c61..e2394db10 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ pip install "browser-use[memory]"
Install Patchright:
```bash
-patchright install chromium --with-deps --no-shell
+playwright install chromium --with-deps --no-shell
```
Spin up your agent:
diff --git a/browser_use/agent/playwright_script_generator.py b/browser_use/agent/playwright_script_generator.py
index 346a570f6..d158a79e9 100644
--- a/browser_use/agent/playwright_script_generator.py
+++ b/browser_use/agent/playwright_script_generator.py
@@ -136,7 +136,7 @@ class PlaywrightScriptGenerator:
'import sys',
'from pathlib import Path', # Added Path import
'import urllib.parse', # Needed for search_google
- 'from patchright.async_api import async_playwright, Page, BrowserContext', # Added BrowserContext
+ 'from playwright.async_api import async_playwright, Page, BrowserContext', # Added BrowserContext
'from dotenv import load_dotenv',
'',
'# Load environment variables',
diff --git a/browser_use/agent/playwright_script_helpers.py b/browser_use/agent/playwright_script_helpers.py
index f24a17681..5ef0a6341 100644
--- a/browser_use/agent/playwright_script_helpers.py
+++ b/browser_use/agent/playwright_script_helpers.py
@@ -1,4 +1,4 @@
-from patchright.async_api import Page
+from playwright.async_api import Page
# --- Helper Function for Replacing Sensitive Data ---
diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.py
index 51786b311..30152c539 100644
--- a/browser_use/browser/browser.py
+++ b/browser_use/browser/browser.py
@@ -13,8 +13,8 @@ from typing import Literal
import httpx
import psutil
from dotenv import load_dotenv
-from patchright.async_api import Browser as PlaywrightBrowser
-from patchright.async_api import Playwright, async_playwright
+from playwright.async_api import Browser as PlaywrightBrowser
+from playwright.async_api import Playwright, async_playwright
from pydantic import AliasChoices, BaseModel, ConfigDict, Field
load_dotenv()
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.py
index 49b686105..7ebcb25c5 100644
--- a/browser_use/browser/context.py
+++ b/browser_use/browser/context.py
@@ -15,12 +15,12 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING
import anyio
-from patchright._impl._errors import TimeoutError
-from patchright.async_api import Browser as PlaywrightBrowser
-from patchright.async_api import (
+from playwright._impl._errors import TimeoutError
+from playwright.async_api import Browser as PlaywrightBrowser
+from playwright.async_api import (
BrowserContext as PlaywrightBrowserContext,
)
-from patchright.async_api import (
+from playwright.async_api import (
ElementHandle,
FrameLocator,
Page,
diff --git a/browser_use/browser/dolphin_service.py b/browser_use/browser/dolphin_service.py
index cb4d13272..b90585c4b 100644
--- a/browser_use/browser/dolphin_service.py
+++ b/browser_use/browser/dolphin_service.py
@@ -2,7 +2,7 @@ import logging
import os
import aiohttp
-from patchright.async_api import Page, async_playwright
+from playwright.async_api import Page, async_playwright
from browser_use.browser.service import Browser
from browser_use.browser.views import BrowserState, TabInfo
diff --git a/browser_use/controller/registry/views.py b/browser_use/controller/registry/views.py
index 46e0b8e77..8f41cb948 100644
--- a/browser_use/controller/registry/views.py
+++ b/browser_use/controller/registry/views.py
@@ -1,6 +1,6 @@
from collections.abc import Callable
-from patchright.async_api import Page
+from playwright.async_api import Page
from pydantic import BaseModel, ConfigDict
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index ccbeba39f..4b318452d 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -7,7 +7,7 @@ from typing import Generic, TypeVar, cast
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.prompts import PromptTemplate
-from patchright.async_api import ElementHandle, Page
+from playwright.async_api import ElementHandle, Page
# from lmnr.sdk.laminar import Laminar
from pydantic import BaseModel
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.py
index c2d71874e..e75bc62b3 100644
--- a/browser_use/dom/service.py
+++ b/browser_use/dom/service.py
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING
from urllib.parse import urlparse
if TYPE_CHECKING:
- from patchright.async_api import Page
+ from playwright.async_api import Page
from browser_use.dom.views import (
DOMBaseNode,
diff --git a/docs/customize/agent-settings.mdx b/docs/customize/agent-settings.mdx
index f512c5cdf..b17ca6613 100644
--- a/docs/customize/agent-settings.mdx
+++ b/docs/customize/agent-settings.mdx
@@ -92,7 +92,7 @@ await browser.close()
```python
from browser_use import Agent, Browser
-from patchright.async_api import BrowserContext
+from playwright.async_api import BrowserContext
# Use specific browser context (preferred method)
async with await browser.new_context() as context:
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index d5eb0a5a9..aea07056a 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -32,10 +32,10 @@ Install the dependencies:
uv pip install browser-use
```
-Then install patchright:
+Then install playwright:
```bash
-uv run patchright install
+uv run playwright install
```
## Create an agent
diff --git a/examples/custom-functions/action_filters.py b/examples/custom-functions/action_filters.py
index c233ea8b1..ef7c60280 100644
--- a/examples/custom-functions/action_filters.py
+++ b/examples/custom-functions/action_filters.py
@@ -20,7 +20,7 @@ During each step, the agent recalculates the actions available specifically for
import asyncio
from langchain_openai import ChatOpenAI
-from patchright.async_api import Page
+from playwright.async_api import Page
from browser_use.agent.service import Agent, Browser, BrowserContext, Controller
diff --git a/pyproject.toml b/pyproject.toml
index 0f994f8d0..25bb8b1c2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,7 +17,7 @@ dependencies = [
"python-dotenv>=1.0.1",
"requests>=2.32.3",
"posthog>=3.7.0",
- "patchright>=1.51.0",
+ "playwright>=1.52.0",
"markdownify==1.1.0",
"langchain-core==0.3.49",
"langchain-openai==0.3.11",
diff --git a/tests/test_action_filters.py b/tests/test_action_filters.py
index d3f8b9e2f..4b8d12a90 100644
--- a/tests/test_action_filters.py
+++ b/tests/test_action_filters.py
@@ -1,7 +1,7 @@
from unittest.mock import MagicMock
import pytest
-from patchright.async_api import Page
+from playwright.async_api import Page
from pydantic import BaseModel
from browser_use.controller.registry.service import Registry
diff --git a/tests/test_attach_chrome.py b/tests/test_attach_chrome.py
index 18b3155ab..2271f3f07 100644
--- a/tests/test_attach_chrome.py
+++ b/tests/test_attach_chrome.py
@@ -1,6 +1,6 @@
import asyncio
-from patchright.async_api import async_playwright
+from playwright.async_api import async_playwright
async def test_full_screen(start_fullscreen: bool, maximize: bool):
diff --git a/tests/test_full_screen.py b/tests/test_full_screen.py
index 5fb4e5617..011f696fa 100644
--- a/tests/test_full_screen.py
+++ b/tests/test_full_screen.py
@@ -1,6 +1,6 @@
import asyncio
-from patchright.async_api import async_playwright
+from playwright.async_api import async_playwright
async def test_full_screen(start_fullscreen: bool, maximize: bool):