Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37844

it seems page.open() function will be skiped in my for loop

Newsgroups comp.lang.javascript
Date 2019-11-23 00:57 -0800
Message-ID <4acb427b-7d1f-4e7b-adb8-904d60fbc86a@googlegroups.com> (permalink)
Subject it seems page.open() function will be skiped in my for loop
From Schorsch Zwanglos <g65432111@googlemail.com>

Show all headers | View raw


What is going wrong in my code? The page.open() function is never executed?

##############################################################################
var system = require('system');
var page = require('webpage').create();
var fs = require('fs'),
    filedata = fs.read('user2.csv'), // read the file into a single string
    arrdata = filedata.split(/[\n]/); // split the string on newline and store in array
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36';
page.settings.javascriptEnabled = true;
page.settings.loadImages = false; //Script is much faster with this field set to false
phantom.cookiesEnabled = true;
phantom.javascriptEnabled = true;
phantom.addCookie({
  'name'     : 'jive.security.context',
  'value'    : '9+eipqmjkQpF4qiEAe5O6gAAAbvCOneajVty9+fawbkGQXrsg0aS0gD06GJAZCq66825axo+yFL7N+A5h6xWuWw0Hfo=',
  'domain'   : 'connect.jive.com',
  'path'     : '/',
  'httponly' : false,
  'secure'   : false
});
for(var i=0; i < arrdata.length; i++) {
   console.log("# " + arrdata[i]);
   page.open(arrdata[i],function() {
     console.log(page.content);
   });
}
phantom.exit();

Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread


Thread

it seems page.open() function will be skiped in my for loop Schorsch Zwanglos <g65432111@googlemail.com> - 2019-11-23 00:57 -0800

csiph-web