mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
- Introduced `record_video_framerate` and `record_video_size` parameters to the BrowserSession class for enhanced video recording capabilities. - Updated example in video_recording.py to reflect changes, switching from BrowserSession to Browser for video recording setup. This update allows users to customize video recording settings more effectively.
26 lines
750 B
Python
26 lines
750 B
Python
import asyncio
|
|
from pathlib import Path
|
|
|
|
from browser_use import Agent, Browser, ChatOpenAI
|
|
|
|
# NOTE: To use this example, install imageio[ffmpeg], e.g. with uv pip install "browser-use[video]"
|
|
|
|
|
|
async def main():
|
|
browser_session = Browser(record_video_dir=Path('./tmp/recordings'))
|
|
|
|
agent = Agent(
|
|
task='Go to github.com/trending then navigate to the first trending repository and report how many commits it has.',
|
|
llm=ChatOpenAI(model='gpt-4.1-mini'),
|
|
browser_session=browser_session,
|
|
)
|
|
|
|
await agent.run(max_steps=5)
|
|
|
|
# The video will be saved automatically when the agent finishes and the session closes.
|
|
print('Agent run finished. Check the ./tmp/recordings directory for the video.')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|