To automate specific websites (e.g., PayPal, Sora, Veo), you should create a subclass of FingerprintBrowserAutomationBase. This base class provides reusable, high-level primitives for page-level automation, such as safe clicking, text input, and human-like interactions. You should use these primitives to compose your business logic and selectors rather than writing raw Playwright commands, which reduces errors and repetition.
Design Principles:
- Methods are generally "best-effort" and return a
bool indicating success. For critical actions, check the return value or use methods with raise_on_fail=True. - Use
step_log to record human-readable operation steps for frontend display. - The class handles common Playwright complexities like locator differences and fallback click mechanisms.
from src.services.browser_automation_base import FingerprintBrowserAutomationBase
class MySiteExecutor(FingerprintBrowserAutomationBase):
async def run_business_flow(self):
# Use base primitives to implement site-specific logic
await self.goto("https://example.com")
await self.fill_first(["#username", "#email"], "my_user_id", label="Login ID")
await self.safe_click(["button.submit"], label="Submit Button")