0

I'm trying to scroll down a google play webpage (https://play.google.com/store/apps/category/HEALTH_AND_FITNESS/collection/topselling_free) with Phantomjs.

I've tried with the method described in the answer(How to scroll down with Phantomjs to load dynamic content), but it gives a error message "TypeError: HTMLScriptElement is not a function (evaluating 'el(kl(window.location.href))')" and doesn't works...

here's my code..

page.open(url, function() {
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js", function() {
    var cnt = 1;
    var history = 0;
    window.setInterval(function() {
        console.log(cnt);
        var rettext = page.evaluate(function() {                
            window.document.body.scrollTop = document.body.scrollHeight;
            return $("a.title").text();
        });

        var height = page.evaluate(function() {
            return document.body.scrollTop;
        });

        cnt = cnt + 1;

        if(cnt > 10 || history == height){
            console.log(rettext);
            console.log(system.args[2])
            phantom.exit();
        }

        history = height;


    //interval
    }, 5000);
});
});

I think this code works on the most of dynamic web pages but there's something to disturb scrolling down in the google webpages.

Is there some way to resolve this problem?

Community
  • 1
  • 1
ycyoon
  • 187
  • 1
  • 2
  • 12

0 Answers0