F
F
Festelo2017-02-19 16:18:03
PhantomJS
Festelo, 2017-02-19 16:18:03

How to open a new page and get a new value from it?

There is a function that receives a list of urls, you need to open your page for each url and get the value.
Something like this:

function something(urls){
  var ret = [];
  for (var i = 0; i < urls.length; i++){
    var newpage = require('webpage').create();
    var data = newpage.open(urls[i], function(status) { return document.getElementById(...).innerText; })
    ret.push(data);
  }
  return ret;
}

How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
smagoldiwe, 2017-02-19
@Festelo

Use jquery. This is a very handy and functional library!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question