Skip to content

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

Fix lint errors

Magnus Mülleraf04b713d5ef
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index 503fa83eb..4f5bfc142 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -137,7 +137,8 @@ class Controller(Generic[Context]):
)
async def wait(seconds: int = 3):
# Cap wait time at maximum 10 seconds
- # 3 seconds already waited by calling the llm
+ # Reduce the wait time by 3 seconds to account for the llm call which takes at least 3 seconds
+ # So if the model decides to wait for 5 seconds, the llm call took at least 3 seconds, so we only need to wait for 2 seconds
actual_seconds = min(max(seconds - 3, 0), 10)
if actual_seconds != seconds:
diff --git a/tests/ci/test_controller.py b/tests/ci/test_controller.py
index 0b23dabff..94de1b428 100644
--- a/tests/ci/test_controller.py
+++ b/tests/ci/test_controller.py
@@ -328,7 +328,7 @@ class TestControllerIntegration:
assert result.extracted_content is not None
assert 'Waiting for' in result.extracted_content
- # Verify that less than 0.1 second has passed (because we substract 3 seconds to account for the llm call)
+ # Verify that less than 0.1 second has passed (because we deducted 3 seconds to account for the llm call)
assert end_time - start_time <= 0.1 # Allow some timing margin
# longer wait