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 = []; page.on('pageerror', e => errs.push(e.message.slice(0, 90))); 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)); // screenshot: sekcja płatności (BLIK default) await page.evaluate(() => { const el = document.querySelector('.bs-pay-methods') || document.querySelector('#payment'); if (el) el.scrollIntoView({ block: 'center' }); }); await new Promise(r => setTimeout(r, 800)); await page.screenshot({ path: 'fin_blik.png' }); // kliknij Kartę await page.evaluate(() => { const b = document.querySelector('.bs-pay-opt[data-pay=card]'); if (b) b.click(); }); await new Promise(r => setTimeout(r, 1500)); await page.screenshot({ path: 'fin_card.png' }); // footer await page.evaluate(() => { const el = document.querySelector('.bs-footer-pay'); if (el) el.scrollIntoView({ block: 'center' }); }); await new Promise(r => setTimeout(r, 1000)); await page.screenshot({ path: 'fin_footer.png' }); const state = await page.evaluate(() => ({ blikLogoImg: !!document.querySelector('.bs-pay-logo--blik'), visaImg: !!document.querySelector('.bs-pay-logos img'), submitLogo: !!document.querySelector('.bs-pay-blik-submit-logo'), strip: !!document.querySelector('.bs-footer-pay-strip img'), labels: [...document.querySelectorAll('#wc-globalpayments_gpapi-cc-form label')].map(l => l.textContent.trim()), })); console.log(JSON.stringify(state, null, 1)); console.log('ERRS:', JSON.stringify(errs)); await browser.close(); })().catch(e => console.error('ERR', e.message));