Phantomjs I can not assign value to a property of an array of objects

2

I'm creating a script that takes links from a phantomjs site. My idea is to store in a vector the link with its innerHTMl and then I need to modify the link, but when I modify it later I can not.

My code:

var player = 0;
var links = page.evaluate(function() {
                var a = document.querySelectorAll(".link[rel='nofollow']:not(#bg)");
                for(var i =0; i < a.length; i++) {
                    array.push({
                        "html":a[i].innerHTML,
                        "link":a[i].href
                    }
                    );
                }
               return array;
            });

 //Valor não está sendo definido
  links[player]["link"] = 1;
    
asked by anonymous 26.08.2016 / 17:50

0 answers