2 lines
1.7 KiB
JavaScript
2 lines
1.7 KiB
JavaScript
async(page)=>{let o={};await page.setViewportSize({width:390,height:1000});await page.goto('http://127.0.0.1:54623/#home');await page.evaluate(()=>scrollTo({top:0,behavior:'instant'}));o.home=await page.evaluate(()=>({titleY:document.querySelector('.lead h2').getBoundingClientRect().top,heroHeight:document.querySelector('.hero').getBoundingClientRect().height,headline:document.querySelector('.hero h1').innerText,schemes:document.querySelector('.lead aside').innerText}));await page.goto('http://127.0.0.1:54623/#catalog');o.search=[];for(const q of ['Bitrix','Windows','Rust']){await page.locator('#query').fill(q);o.search.push({q,text:await page.locator('#count').innerText(),visible:await page.locator('#results>.entry:visible').count()});}await page.locator('#reset').click();await page.locator('[data-topic="D"]').click();o.search.push({q:'D',text:await page.locator('#count').innerText()});await page.locator('#reset').click();await page.locator('[data-open="2"]').filter({visible:true}).first().click();await page.waitForTimeout(100);o.tilix={title:await page.locator('#article-title').innerText(),author:await page.locator('#author').innerText(),chars:(await page.locator('#body').innerText()).length};await page.locator('#body').evaluate(e=>window.scrollTo({top:e.getBoundingClientRect().bottom+scrollY-800,behavior:'instant'}));await page.screenshot({path:'/tmp/progcode-content-v3-readings/board-tilix-end-390.png'});await page.goto('http://127.0.0.1:54623/#kit');o.kitLinks=await page.locator('#kit a').evaluateAll(es=>es.map(e=>({text:e.textContent,href:e.getAttribute('href')})));await page.locator('#json').fill('{bad');await page.locator('#format').click();o.json=await page.locator('#jsonstate').innerText();return o;}
|