peerigon / phridge

A bridge between node and PhantomJS
The Unlicense
519 stars 50 forks source link

Evaluate returning "null" #39

Closed herlon214 closed 8 years ago

herlon214 commented 9 years ago

As in the example:

page.open("http://www.google.com", function () {
        var text = page.evaluate(function (selector) {
            return document.querySelector(selector).innerText;
        }, selector);

        // resolve the promise and pass 'text' back to node 
        resolve(text);
    });

Returns: The element contains the following text: null Why?

jhnns commented 9 years ago

What selector do you pass in?

herlon214 commented 9 years ago

Anyone, I test the same as the example too @jhnns

jhnns commented 9 years ago

Please give me a complete working example that helps me to reproduce the problem. I cannot check your example.