Files
browser-use/examples/features
RogelioRichmanAstronaut 71400d93e6 feat: Add Playwright script generation from agent history
Implement the ability to generate executable Playwright scripts from an Agent's run history (`AgentHistoryList`).

This introduces the `PlaywrightScriptGenerator` class which translates recorded agent actions (clicks, inputs, navigation, etc.) into a Python script using Playwright's async API.

Key features:
- Uses XPath selectors derived from the agent's interaction history.
- Includes a robust helper function (`_try_locate_and_act`) with XPath prefix trimming for improved resilience on dynamic pages.
- Handles sensitive data placeholders by mapping them to environment variables in the generated script.
- Supports configuring the browser launch and context based on the original agent's `BrowserConfig` and `BrowserContextConfig`.
- Activated by setting the `save_playwright_script_path` option in `AgentSettings`.

Includes modifications to `Agent` service to trigger generation and `AgentHistoryList` view to add the saving method. Also adds a new example (`examples/features/playwright_script_generation.py`).

This feature enables reliable replay of agent runs, automated testing, and scripting of repetitive tasks discovered by the agent.
2025-04-21 11:05:06 -05:00
..
2025-03-28 18:11:36 -07:00
2025-01-26 15:44:44 +01:00
2025-04-01 08:14:15 +05:30
2025-03-27 11:10:41 -07:00
2025-01-31 23:38:23 -08:00
2025-01-25 11:28:52 -08:00
2025-02-14 18:56:57 +01:00
2025-01-25 11:28:52 -08:00
2025-02-01 18:33:44 -08:00
2025-03-28 01:22:48 -07:00
2025-03-28 15:39:31 -07:00
2025-03-28 18:11:36 -07:00
2025-02-01 01:13:01 -08:00