title: Why does the Resources Received change so frequently for same URL (page.open(url))
body: <p>I am currently working on fetching/<strong>scraping</strong> all the images being received on requesting a URL.</p>
  <p>The problem i am facing is the response changes after few tries or is very inconsistent even for the same URL using the phantomjs.</p>
  <p>I have tried clearing cache multiple times and at different location in my code but the the request numbers dont appear to be the same.</p>
  <p>o/p
  1st call to URL
  19 images and total off 49 responses from server</p>
  <p>2nd call
  14 images and 48 responses from server</p>
  <p>3rd call
  14 images and 38 responses from server</p>
  <p><a href="https://i.stack.imgur.com/mN0et.png" rel="nofollow noreferrer">Output for execution twice</a></p>
  <p><strong>phantomjs-2.1.1-windows
  running a java-script code using the phantomjs command</strong></p>
  <p>I am very new to Javascript, i have manged to write the following till now</p>
  <pre><code>var page =  require('webpage').create();
  var fs = require('fs');
  var url = &quot;https://..........&quot;;
  
  page.settings.clearMemoryCaches = true;
  page.clearMemoryCache();
  page.clearCookies();
  page.viewportSize = {width: 1280, height: 1024};
  
  var imageCounter = 0;
  var responseCounter = 0;
  
  
  page.open(url, function (status) {
  console.log(status + '*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/')
      if(status=='success'){
          console.log('The entire page is loaded.............################');
          console.log('\n' + imageCounter + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n');
          console.log('\n' + responseCounter + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n');
          imageCounter = 0;
  
          page.clearMemoryCache();
          page.clearCookies();
          page.close();
          phantom.exit();
      }
  });
  
  
  
  page.onResourceReceived = function(response) {      
      if(response.stage == &quot;start&quot;){
          responseCounter++;
          var respType = response.contentType;
          
          if(respType.indexOf(&quot;image&quot;)==0){
              imageCounter++;
              //console.log('Content-Type : ' + response.contentType)
              //console.log('Status : ' + response.status)
              //console.log('Image Size in byte : ' + response.bodySize)
              //console.log('Image Url : ' + response.url)
              //console.log('\n');
              console.log(imageCounter + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n');
          }       
      }
  };
  </code></pre>
  <p>I want to get consistent response for the images at least, I am really confused how does phantom cache this kind of resources on second attempt.</p>