← back to Charge And Explore
support-form/step1-open.cjs
23 lines
// Step 1: open a NEW tab in the live Chrome (CDP :9223), go to the Tesla
// developer dashboard, screenshot the resulting state. Never touches the
// parked Uber tab.
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 = await ctx.newPage();
await page.goto('https://developer.tesla.com/dashboard', { waitUntil: 'domcontentloaded', timeout: 60000 });
await page.waitForTimeout(6000);
console.log('URL:', page.url());
console.log('TITLE:', await page.title());
await page.screenshot({ path: __dirname + '/s1-landing.png', fullPage: false });
// dump visible input fields + buttons for state detection
const fields = await page.$$eval('input, button, a', els => els.slice(0, 40).map(e => ({
tag: e.tagName, type: e.type || '', name: e.name || '', id: e.id || '',
text: (e.innerText || e.value || e.placeholder || '').slice(0, 60)
})).filter(x => x.text || x.name || x.id));
console.log(JSON.stringify(fields, null, 1));
process.exit(0);
})().catch(e => { console.error('ERR', e.message); process.exit(1); });