Skip to content

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

refactor the imports

Naymul Islam1f3115e63a46
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index 86cc720f3..56c0821b0 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -2,7 +2,7 @@ import asyncio
import json
import logging
from typing import Dict, Generic, Optional, Type, TypeVar
-
+import datetime
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.prompts import PromptTemplate
@@ -191,8 +191,6 @@ class Controller(Generic[Context]):
async def download_html(_: NoParamsAction, browser: BrowserContext) -> ActionResult:
"""Retrieves and returns the full HTML content of the current page to a file"""
try:
- import re
- import datetime
page = await browser.get_current_page()
html_content = await page.content()