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: 1300 }); await page.setCookie({ name: 'PLESKSESSID', value: 'ac68b2d34301cce8d78624231877bc21', domain: 'bazarowy-swiat.pl', path: '/' }); await page.goto('https://bazarowy-swiat.pl:8443/modules/git/index.php/domain/repositories?dom_id=529&site_id=581', { waitUntil: 'networkidle2', timeout: 90000 }); await new Promise(r => setTimeout(r, 5000)); // najpierw sprawdz czy akcja jest zapisana (otworz settings, odczytaj, zamknij) await page.mouse.click(744, 980); await new Promise(r => setTimeout(r, 4000)); const cfg = await page.evaluate(() => ({ cbs: [...document.querySelectorAll('input[type="checkbox"]')].map(c => c.checked), tas: [...document.querySelectorAll('textarea')].map(t => t.value.slice(0, 160)), })); console.log('saved cfg:', JSON.stringify(cfg)); // zamknij modal (Anuluj) await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find(x => /Anuluj/.test(x.innerText) && x.offsetParent); if (b) b.click(); }); await new Promise(r => setTimeout(r, 2000)); // Wdroz teraz const clicked = await page.evaluate(() => { const b = [...document.querySelectorAll('button, a')].find(x => /Wdr[oó]ż teraz/i.test(x.innerText) && x.offsetParent); if (b) { b.click(); return 'clicked'; } return 'not found'; }); console.log('deploy:', clicked); await new Promise(r => setTimeout(r, 20000)); await page.screenshot({ path: 'plesk_deploy2.png' }); await browser.close(); })().catch(e => { console.error('ERR', e.message); });