Research-Stack/5-Applications/plugins/debug/list_all_buttons.py
allaun 5f80fd8429 chore(repo): push local 768-commit branch state onto clean remote baseline
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.

Build: N/A (working tree state only)
2026-06-15 22:46:50 -05:00

53 lines
2 KiB
Python

import sqlite3
import shutil
import asyncio
from playwright.async_api import async_playwright
def get_tokens():
db_path = "/run/user/1000/psd/allaun-firefox-tobv72sv.default-release/storage/default/https+++contextstream.io/ls/data.sqlite"
temp_db = "/home/allaun/.gemini/antigravity/scratch/ls_temp.sqlite"
shutil.copy(db_path, temp_db)
conn = sqlite3.connect(temp_db)
cursor = conn.cursor()
cursor.execute("SELECT key, value FROM data WHERE key IN ('auth_token', 'refresh_token');")
tokens = {}
for key, val in cursor.fetchall():
tokens[key] = val.decode('utf-8', errors='ignore')
conn.close()
return tokens
async def main():
tokens = get_tokens()
auth_token = tokens.get("auth_token")
refresh_token = tokens.get("refresh_token")
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()
page = await context.new_page()
await page.goto("https://contextstream.io")
await page.wait_for_timeout(2000)
await page.evaluate("""([auth, refresh]) => {
localStorage.setItem('auth_token', auth);
localStorage.setItem('refresh_token', refresh);
}""", [auth_token, refresh_token])
await page.goto("https://contextstream.io/dashboard?stage=skills")
await page.wait_for_timeout(4000)
print("Listing all button-like elements:")
buttons = await page.locator("button, [role='button'], [role='combobox']").all()
for idx, btn in enumerate(buttons):
text = await btn.inner_text()
aria_label = await btn.get_attribute("aria-label")
id_attr = await btn.get_attribute("id")
html = await btn.evaluate("e => e.outerHTML.slice(0, 150)")
print(f" Button {idx}: id='{id_attr}', text='{text.strip()}', aria-label='{aria_label}', HTML={html}")
await browser.close()
if __name__ == "__main__":
asyncio.run(main())