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: 1200 }); 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)); // akceptuj cookies await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find(x => /Akceptuj niezb[eę]dne/i.test(x.innerText)); if (b) b.click(); }); await new Promise(r => setTimeout(r, 1500)); const clicked = await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find(x => /Pobierz teraz/i.test(x.innerText)); if (b) { b.click(); return 'clicked Pobierz teraz'; } return 'not found: ' + [...document.querySelectorAll('button')].map(x => x.innerText).join('|'); }); console.log(clicked); // czekaj na odswiezenie listy commitow await new Promise(r => setTimeout(r, 15000)); const commits = await page.evaluate(() => document.body.innerText.slice(0, 2000)); console.log(commits); await page.screenshot({ path: 'plesk_fetched.png', fullPage: true }); await browser.close(); })().catch(e => { console.error('ERR', e.message); });