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)); await page.mouse.click(744, 980); await new Promise(r => setTimeout(r, 4000)); let st = await page.evaluate(() => ({ cbs: [...document.querySelectorAll('input[type="checkbox"]')].map(c => ({ checked: c.checked, vis: !!c.offsetParent })), tas: [...document.querySelectorAll('textarea')].map(t => ({ val: t.value.slice(0, 150), vis: !!t.offsetParent })), title: document.body.innerText.match(/Ustawienia[^\n]*/)?.[0], })); console.log('gear@744:', JSON.stringify(st)); if (!st.cbs.length) { // sprobuj 776 (moze gear jest trzecia ikona) await page.mouse.click(776, 980); await new Promise(r => setTimeout(r, 4000)); st = await page.evaluate(() => ({ cbs: [...document.querySelectorAll('input[type="checkbox"]')].map(c => ({ checked: c.checked, vis: !!c.offsetParent })), tas: [...document.querySelectorAll('textarea')].map(t => ({ val: t.value.slice(0, 150), vis: !!t.offsetParent })), })); console.log('gear@776:', JSON.stringify(st)); } await page.screenshot({ path: 'plesk_settings4.png' }); await browser.close(); })().catch(e => { console.error('ERR', e.message); });