overseas-lavender
overseas-lavender4y ago

How to click on pagination of js links?

The pagination links are not changing the url, they dont have href value. I think it must click on the first link, scrape the page, and then move to the next link, and it should happen in the same tab, there is no need for new tabs. You can see the pagination here: https://www.paz.co.il/he-IL/paz-stations Please help, thank you @thek1tten@Lukas Krivka @pczr
5 Replies
flat-fuchsia
flat-fuchsia4y ago
you can do a click while using page.waitForNavigation() usually it's
const tabs = await page.$$('selector');
for (const tab of tabs) {
await Promise.all([
tab.click(),
page.waitForNavigation(),
]);
}
const tabs = await page.$$('selector');
for (const tab of tabs) {
await Promise.all([
tab.click(),
page.waitForNavigation(),
]);
}
overseas-lavender
overseas-lavenderOP4y ago
Thanks but I can't get it right, can you help me modify the code?
flat-fuchsia
flat-fuchsia4y ago
your top const data = await page.$$eval('.result-row', ($posts) => { call needs to be inside the loop
flat-fuchsia
flat-fuchsia4y ago
overseas-lavender
overseas-lavenderOP4y ago
@pczr Can you please try to run it? It still scrapes only the results from the first page, and it scrape them many times again and again up Please help me solve this issue

Did you find this page helpful?