from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp('http://localhost:9222')
    page = browser.contexts[0].pages[0]
    page.goto('https://www.facebook.com/me', wait_until='domcontentloaded', timeout=30000)
    page.wait_for_timeout(3000)
    
    # Tìm tất cả buttons trên trang profile
    buttons = page.locator("div[role='button']").all()
    print('Total role=button found:', len(buttons))
    for b in buttons:
        txt = b.inner_text().strip().replace('\n', ' ')
        if any(k in txt.lower() for k in ['edit', 'bio', 'story', 'detail', 'profile']):
            print('Button:', txt)
