← back to Charge And Explore
support-form/step6-sitekey.cjs
19 lines
const { chromium } = require('/Users/macstudio3/uber-address-fix/node_modules/playwright');
(async () => {
const browser = await chromium.connectOverCDP('http://127.0.0.1:9223');
const ctx = browser.contexts()[0];
const page = ctx.pages().find(p => p.url().includes('auth.tesla.com'));
if (!page) { console.error('no tesla tab'); process.exit(1); }
const info = await page.evaluate(() => {
const out = {};
const el = document.querySelector('[data-sitekey]');
if (el) out.dataSitekey = el.getAttribute('data-sitekey');
const ifr = [...document.querySelectorAll('iframe')].find(f => /hcaptcha/.test(f.src || ''));
if (ifr) { out.iframeSrc = ifr.src; const m = ifr.src.match(/[?&]sitekey=([^&]+)/); if (m) out.iframeSitekey = m[1]; }
return out;
});
console.log('URL:', page.url());
console.log(JSON.stringify(info, null, 1));
process.exit(0);
})().catch(e => { console.error('ERR', e.message); process.exit(1); });