Skip to content

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

Update import paths for Playwright types in custom functions

Cursor Agentfcfd80bbca8a
diff --git a/docs/customize/custom-functions.mdx b/docs/customize/custom-functions.mdx
index 74ffd4d90..33abbb483 100644
--- a/docs/customize/custom-functions.mdx
+++ b/docs/customize/custom-functions.mdx
@@ -116,7 +116,7 @@ For example, actions that need to run playwright code to interact with the brows
#### Example: Action uses the current `page`
```python
-from playwright.async_api import Page
+from browser_use.browser.types import Page
from browser_use import Controller, ActionResult
controller = Controller()
diff --git a/examples/custom-functions/drag_and_drop.py b/examples/custom-functions/drag_and_drop.py
index a8a6a588b..85c4cc518 100644
--- a/examples/custom-functions/drag_and_drop.py
+++ b/examples/custom-functions/drag_and_drop.py
@@ -9,10 +9,10 @@ making it useful for canvas drawing, sortable lists, sliders, file uploads, and
import asyncio
from typing import cast
-from playwright.async_api import ElementHandle, Page
from pydantic import BaseModel, Field
from browser_use import ActionResult, Agent, Controller
+from browser_use.browser.types import ElementHandle, Page
from browser_use.llm import ChatOpenAI