const puppeteer = require('C:/xampp/htdocs/vilmax/vilmax-cockpit/node_modules/puppeteer'); (async () => { const browser = await puppeteer.launch({ headless: 'new', args: ['--ignore-certificate-errors'] }); const page = await browser.newPage(); await page.setViewport({ width: 1440, height: 1400 }); const errs = [], failed = []; page.on('console', m => { if (m.type() === 'error') errs.push(m.text().slice(0, 160)); }); page.on('pageerror', e => errs.push('PAGEERROR: ' + e.message.slice(0, 160))); page.on('requestfailed', r => failed.push(r.url().slice(0, 140) + ' :: ' + (r.failure() || {}).errorText)); await page.goto('https://bazarowy-swiat.pl/?add-to-cart=7892&variation_id=7892&attribute_pa_strona=lewy&attribute_pa_kod-odcienia=39&quantity=1', { waitUntil: 'networkidle2', timeout: 90000 }); await page.goto('https://bazarowy-swiat.pl/zamowienie/', { waitUntil: 'networkidle2', timeout: 90000 }); await new Promise(r => setTimeout(r, 9000)); // kliknij metode eservice zeby rozwinac box await page.evaluate(() => { const r = document.querySelector('input[name=payment_method]'); if (r && !r.checked) r.click(); const rb = document.getElementById('payment_method_globalpayments_gpapi'); if (rb) rb.click(); }); await new Promise(r => setTimeout(r, 4000)); const box = await page.evaluate(() => { const el = document.querySelector('.payment_method_globalpayments_gpapi'); return el ? el.innerHTML.replace(/]*>/g, '').slice(0, 3000) : 'not found'; }); console.log(box); await page.screenshot({ path: 'checkout_payment.png', fullPage: true }); console.log('FAILED-REQ:', JSON.stringify(failed.slice(0, 15), null, 1)); console.log('ERRS:', JSON.stringify([...new Set(errs)].slice(0, 15), null, 1)); await browser.close(); })().catch(e => console.error('ERR', e.message));