Phantomjs I cannot assign value to an object array property

Asked

Viewed 30 times

2

I’m creating a script that picks up links from a website on phantomjs. My idea is to store in a vector the link with his innerHTMl and then I need to modify the link, but when I will modify later I can’t.

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;
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.