OptimalBits / Crawlme

Ajax crawling for your web application
67 stars 11 forks source link

Seems like the zombie api changed? #5

Open alexanderkjeldaas opened 10 years ago

alexanderkjeldaas commented 10 years ago

According to this:

https://groups.google.com/forum/#!msg/zombie-js/qOS0W_cMCgQ/4iFcqLjVEPgJ

It seems like this code in crawlme.js cannot work because the callback doesn't get browser. Simply removing the browser argument from the callback seems to fix the issue.

browser.visit(url, {waitFor: options.waitFor},
  function(err, browser, status) {
    if(err) return cb(err);

    // links
    var links = browser.queryAll('a'); // browser is undefined
    links.forEach(function(link) {
      var href = link.getAttribute('href');
      var absoluteUrl = urlParser.resolve(url, href);
      link.setAttribute('href', absoluteUrl);
    });
arokor commented 10 years ago

We are calling Browser.visit() which is different from (new Browser()).visit() so this should work fine. Are you getting an error?