assaf/zombie — Issue #266: query/All selectors are not returning expected results
Author: lundin
Created: 2012-01-20 03:10:12+00:00
State: open

Hi,
Actually i wrote this in one of the closed issues, but if i guess it can easily be overlooked.So here it goes:

I am new to Zombie (and nodejs) but I am having problems with the selectors. Looked into the source (and i guess it rely upon JSdom).

browser.html() has the content, it never fails.However html(selector) always returns the entire document no mater the selector.

browser.query or queryAll ('div') =>always returns undefined

browser.document.getElementById('whatever')=>return null

What am i missing ?

The thing (and this is so strange) is that i have "somehow" made it work once, becuase i have a file with all a hrefs in a document by query

zombie.visit("myURL", function (err, browser) {
if (err)
throw(err.message);
console.log (browser.html());
fs.createWriteStream("file", {
flags: "a",
encoding: "encoding",
mode: 0666
}).write(browser.document.querySelectorAll("a[href^=]"));
});

however, i dont remember if this was the piece of code i was using becuase i cant replicate it! I have tried everything document.xxxxxx(selector) and nothing returns the correct DOMquery,other than null or undefined.