Many websites utilize single-page pagination to display more content with each click. It can be beneficial to view all the content on one page, such as for web crawling purposes. Much like automatically clicking a button using Greasemonkey, how can JavaScript be used (like in the Firefox console) to locate and continuously click a JavaScript link until the entire page loads? For example, in this scenario, "fully loaded" could mean either
- the disappearance of the "Load More" link or
- the appearance of "No videos found at this time."
I am unsure which events should be monitored on which elements to achieve this efficiently (i.e., waiting the least amount of time between clicks without excessive polling). The provided code below is not functional, most likely because portions of the page do not have sufficient time to load before the next request is made.
for (var i=1; i<209; i++) {
DISCO.video.sort('None','desc',i,'grid');
}