const puppeteer = require('puppeteer'); (async () => { const targetUrl = 'https://test.e-tib.com'; const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026'; const browser = await puppeteer.launch({ headless: true }); const page = await browser.newPage(); await page.goto(targetUrl, { waitUntil: 'networkidle0' }); const isGatekeeper = await page.$('input[name="password"]'); if (isGatekeeper) { await page.type('input[name="password"]', gatekeeperPassword); await Promise.all([ page.click('button[type="submit"]'), page.waitForNavigation({ waitUntil: 'networkidle0' }).catch(() => {}) ]); const html = await page.content(); const fs = require('fs'); fs.writeFileSync('login-result.html', html); } else { console.log("No gatekeeper found!"); } await browser.close(); })();