2

I'm trying to scrape some information from the link (http://www.myntra.com/women-sarees?nav_id=606) that involves lazy loading. Below is my code snippet for this:

window.setInterval(function() {
    //var count returns the visibility of the div that checks for lazyloading
    if((count == 'none')) { // more products to be loaded
        page.evaluate(function() {
            // Scrolls to the bottom of page
            window.document.body.scrollTop = document.body.scrollHeight;
        });
        page.render('myn'+k+'.png');
    }
    else { // Found
        //Do what you want
        //console.log('len123');
}, 5000); // Number o ms to wait between scrolls

But I'm getting only first 6 rows loaded. I don't understand where am I going wrong.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
user2747776
  • 109
  • 1
  • 15
  • have u set the value of count as none ?? – user2129794 Nov 08 '13 at 11:59
  • No. Besides, the problem lies in this " window.document.body.scrollTop = document.body.scrollHeight;" I tried running it in the loop to see if its scrolling down at all, but it's not. Even if I remove this line from my code, the scripts run the same way. – user2747776 Nov 08 '13 at 12:59
  • possible duplicate of [How to scroll down with Phantomjs to load dynamic content](http://stackoverflow.com/questions/16561582/how-to-scroll-down-with-phantomjs-to-load-dynamic-content) – Artjom B. Jun 09 '14 at 16:19

0 Answers0