{"data":{"id":2,"slug":"handling-infinite-scroll-in-playwright-2","title":"Handling infinite scroll in Playwright","excerpt":"Infinite scroll replaces the familiar Next button with a page that keeps growing as you move down it, which means your script has to decide when there is nothing left to load.","seriesName":"Handling infinite scroll in Playwright","seriesPart":1,"sections":[{"heading":"Introduction","paragraphs":["Infinite scroll replaces the familiar Next button with a page that keeps growing as you move down it, which means your script has to decide when there is nothing left to load."]},{"heading":"Putting it into practice","paragraphs":["Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.","Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot."]},{"heading":"Step by step","paragraphs":["Selectors are the most fragile part of any scraper. Prefer stable attributes such as data-testid or semantic structure over generated class names, which can change on every deploy.","Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages."]},{"heading":"Key takeaway","paragraphs":["Scroll, wait for the item count to change, and stop when two consecutive scrolls add nothing new. Better still, find the JSON request the page makes and call it directly."]}],"authorId":12,"authorName":"Yuki Andersson","authorSlug":"yuki-andersson","category":"Browser Automation","tags":["python","selenium","javascript","ethics"],"publishedAt":"2026-03-23T00:00:00.000Z","wordCount":171,"readingTimeMinutes":2}}