import sys
import time
from pathlib import Path
sys.path.append(str(Path("05_Production_Pipeline").resolve()))
from invisible_playwright import InvisiblePlaywright
from muse_invpw_driver import sync_worker_profile, DEFAULT_PROFILE

def check_new_thread():
    sync_worker_profile()
    with InvisiblePlaywright(profile_dir=DEFAULT_PROFILE, headless=True) as ctx:
        page = ctx.pages[0] if ctx.pages else ctx.new_page()
        page.goto("https://muse.ai/thread/new", wait_until="domcontentloaded", timeout=30000)
        time.sleep(3)
        print("URL:", page.url)
        file_input = page.locator('input[type="file"]')
        print("File inputs count:", file_input.count())
        textarea = page.locator('textarea')
        print("Textarea count:", textarea.count())

if __name__ == "__main__":
    check_new_thread()
