← back to Animals

desk-homes-check.mjs

15 lines

import { chromium } from 'playwright';
const b = await chromium.launch();
const ctx = await b.newContext({ httpCredentials: { username: 'admin', password: 'DW2024!' } });
const p = await ctx.newPage(); const errs=[]; p.on('pageerror',e=>errs.push(e.message));
await p.goto('https://rentv.agentabrams.com/desk',{waitUntil:'networkidle',timeout:30000});
await p.click('button[data-s="homes"]'); await p.waitForTimeout(1500);
const badge=await p.textContent('#cH').catch(()=>'?');
const rowCount=await p.locator('#drows .row').count();
let detail='';
if(rowCount>0){await p.locator('#drows .row').first().click();await p.waitForTimeout(400);detail=((await p.textContent('#ddetail').catch(()=>'')||'').replace(/\s+/g,' ').slice(0,140));}
console.log('New Homes badge:',badge,'| rows rendered:',rowCount);
console.log('detail sample:',detail||'(none)');
console.log('page errors:',errs.length?errs.join(' | '):'none');
await b.close();