-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to scroll? #377
Comments
Sorry, @yemd, I cannot reach this library maintainer to get access to publishing updates. I'd recommend building a custom solution using puppeteer instead of using this library. |
Here is how I kept scrolling through a list for lazy loaded products untill the crawler reached the bottom of the page. I hope this helps :) const productCrawler = await Crawler.launch({
/*... */
});
await productCrawler.queue({
url: '...',
retryCount: 1,
maxDepth: 3,
depthPriority: false,
waitUntil: 'networkidle0',
jQuery: false,
waitFor: {
options: {},
args: [config], // args for selectorOrFunctionOrTimeout
selectorOrFunctionOrTimeout: function (config) {
const documentHeight = document.documentElement.scrollHeight;
window.scrollTo(0, documentHeight);
// You might want to check if there are any elements still loading (look for spinners, other indicators, or just wait)
// Return true if you are done scrolling, false otherwise
return true;
},
},
});
await productCrawler.onIdle();
await productCrawler.close(); If not you can always scroll inside the const productCrawler = await Crawler.launch({
// ...
evaluatePage: eval(`() => {
const documentHeight = document.documentElement.scrollHeight;
window.scrollTo(0, documentHeight);
}`),
// ...
}) |
Take a look at get-set-fetch infinite scrolling example. It may prove a viable alternative. |
worked for me like that:
|
What is the current behavior?
No documented way of scrolling
What is the expected behavior?
Being able to scroll
What is the motivation / use case for changing the behavior?
Being able to scroll dynamically loaded content by scrolling
The text was updated successfully, but these errors were encountered: