61 lines
2.1 KiB
JavaScript
Executable File
61 lines
2.1 KiB
JavaScript
Executable File
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch();
|
|
const context = await browser.newContext({ viewport: { width: 1400, height: 800 } });
|
|
const page = await context.newPage();
|
|
|
|
await page.goto('https://homeproz.dev.hanson.xyz/properties/', { timeout: 60000 });
|
|
await page.waitForTimeout(3000);
|
|
|
|
// Disable infinite scroll
|
|
await page.evaluate(() => {
|
|
if (window.PropertyFilters && window.PropertyFilters.infiniteScrollObserver) {
|
|
window.PropertyFilters.infiniteScrollObserver.disconnect();
|
|
}
|
|
document.querySelectorAll('.infinite-scroll-sentinel, .infinite-scroll-loader').forEach(el => el.remove());
|
|
});
|
|
|
|
// Scroll in steps
|
|
let lastScroll = 0;
|
|
for (let i = 0; i < 15; i++) {
|
|
await page.evaluate(() => window.scrollBy(0, 1000));
|
|
await page.waitForTimeout(200);
|
|
|
|
const currentScroll = await page.evaluate(() => window.scrollY);
|
|
const scrollHeight = await page.evaluate(() => document.documentElement.scrollHeight);
|
|
const maxScroll = scrollHeight - 800;
|
|
|
|
console.log(`Step ${i+1}: scrollY=${currentScroll}, scrollHeight=${scrollHeight}, maxScroll=${maxScroll}`);
|
|
|
|
if (currentScroll === lastScroll) {
|
|
console.log('Scroll stopped - cannot scroll further');
|
|
break;
|
|
}
|
|
lastScroll = currentScroll;
|
|
}
|
|
|
|
// Final check
|
|
const final = await page.evaluate(() => {
|
|
const map = document.querySelector('.property-map-container');
|
|
const footer = document.querySelector('footer.site-footer');
|
|
return {
|
|
mapBottom: map ? map.getBoundingClientRect().bottom : null,
|
|
footerTop: footer ? footer.getBoundingClientRect().top : null
|
|
};
|
|
});
|
|
|
|
console.log('\nFinal positions:');
|
|
console.log('Map bottom:', final.mapBottom);
|
|
console.log('Footer top:', final.footerTop);
|
|
|
|
if (final.mapBottom > final.footerTop) {
|
|
console.log('OVERLAP:', final.mapBottom - final.footerTop, 'px');
|
|
} else {
|
|
console.log('Gap:', final.footerTop - final.mapBottom, 'px');
|
|
}
|
|
|
|
await page.screenshot({ path: '/tmp/scroll-steps.png' });
|
|
await browser.close();
|
|
})();
|