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: 'c0f91372744e1522655b681ff15a5f10', 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)); await page.screenshot({ path: 'plesk_d4_page.png' }); const state = await page.evaluate(() => ({ txt: document.body.innerText.slice(0, 800), btns: [...document.querySelectorAll('button, a')].filter(b => b.offsetParent).map(b => b.innerText.trim()).filter(Boolean).slice(0, 30) })); console.log('STATE:', JSON.stringify(state.btns)); console.log(state.txt.slice(0, 400)); // Pobierz teraz (fetch) const f = await page.evaluate(() => { const b = [...document.querySelectorAll('button, a')].find(x => /Pobierz teraz/i.test(x.innerText) && x.offsetParent); if (b) { b.click(); return 'fetch clicked'; } return 'fetch not found'; }); console.log(f); await new Promise(r => setTimeout(r, 15000)); await page.screenshot({ path: 'plesk_d4_fetched.png' }); // Wdroz teraz const d = 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 'deploy clicked'; } return 'deploy not found'; }); console.log(d); await new Promise(r => setTimeout(r, 25000)); await page.screenshot({ path: 'plesk_d4_deployed.png' }); const after = await page.evaluate(() => document.body.innerText.match(/Ostatnia zmiana[^\n]*/)?.[0] || document.body.innerText.slice(0,400)); console.log('AFTER:', after); await browser.close(); })().catch(e => { console.error('ERR', e.message); });