#!/usr/bin/env python3 import asyncio, json from playwright.async_api import async_playwright async def main(): async with async_playwright() as p: # Connect to Blade's Chrome via remote debugging browser = await p.chromium.connect_over_cdp("http://10.1.0.4:9222") contexts = browser.contexts if not contexts: print("No browser contexts") return ctx = contexts[0] results = {} # HuggingFace token pg = await ctx.new_page() await pg.goto("https://huggingface.co/settings/tokens", timeout=15000) await pg.wait_for_timeout(2000) content = await pg.content() if "New token" in content or "access token" in content.lower(): print("HF: logged in via Blade Chrome!") # Could auto-create token here results["hf"] = "session_active" await pg.close() # Meta Business WhatsApp pg2 = await ctx.new_page() await pg2.goto("https://business.facebook.com/latest/whatsapp_manager/phone_numbers", timeout=15000) await pg2.wait_for_timeout(2000) if "Log in" not in await pg2.content(): print("META: logged in via Blade Chrome!") results["meta"] = "session_active" await pg2.close() # O365 Admin pg3 = await ctx.new_page() await pg3.goto("https://admin.microsoft.com/#/users", timeout=15000) await pg3.wait_for_timeout(2000) if "Sign in" not in await pg3.content(): print("O365: logged in via Blade Chrome!") results["o365"] = "session_active" await pg3.close() print(json.dumps(results)) await browser.close() asyncio.run(main())