Skip to content

Commit f9ef26e

Browse files
committed
Add note
1 parent 129d626 commit f9ef26e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/academy/puppeteer_playwright/common_use_cases/paginating_through_results.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ while (products.length < 75) {
485485

486486
Now, the `while` loop will exit out if we've reached the bottom of the page.
487487

488+
> Generally, you'd want to create a utility function that handles this scrolling logic instead of putting all of the code directly into the while loop.
489+
488490
### [](#collecting-data) Collecting data
489491

490492
Within the loop, we can grab hold of the total number of items on the page. To avoid collecting and pushing duplicate items to the **products** array, we can use the `.slice()` method to cut out the items we've already scraped.

0 commit comments

Comments
 (0)