[Python] To Run firefox browser using launch_persistent_context of playwright python

Discussão em 'Python' iniciado por Stack, Novembro 27, 2025.

  1. Stack

    Stack Membro Participativo

    from playwright.sync_api import sync_playwright
    profile_path = r"C:\Users\kdutt\AppData\Roaming\Mozilla\Firefox\Profiles\p283dicx.default-release"
    firefox_path = r"C:\Program Files\Mozilla Firefox\firefox.exe"
    with sync_playwright() as p:
    context = p.firefox.launch_persistent_context(user_data_dir=profile_path,executable_path=firefox_path,headless=False,)
    page = context.new_page()
    url = r"https://example.com/"
    page.goto(url, wait_until="domcontentloaded")
    input("Press Enter to close...")
    page.close()
    context.close()

    Continue reading...

Compartilhe esta Página