Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Can't get this simple script to work! #943

Open
sawteeth opened this issue Sep 1, 2015 · 1 comment
Open

Can't get this simple script to work! #943

sawteeth opened this issue Sep 1, 2015 · 1 comment

Comments

@sawteeth
Copy link

sawteeth commented Sep 1, 2015

var Zombie = require('zombie');

var zombie = new Zombie({
    userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
    debug: true,
    waitFor: 10000
});

var url = 'https://google.com';

zombie.visit(url, function(err, browser) {
    console.log("Currently visiting " + browser.location);
});

Errors:

project/node_modules/zombie/node_modules/bluebird/js/main/promise.js:673
throw e;
^
TypeError: Cannot read property 'location' of undefined
at project/parser/tasks/directory.js:13:48
at tryCatcher (project/node_modules/zombie/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (project/node_modules/zombie/node_modules/bluebird/js/main/promise.js:503:31)
at Promise._settlePromiseAt (project/node_modules/zombie/node_modules/bluebird/js/main/promise.js:577:18)
at Async._drainQueue (project/node_modules/zombie/node_modules/bluebird/js/main/async.js:128:12)
at Async._drainQueues (project/node_modules/zombie/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues as _onImmediate
at processImmediate as _immediateCallback

I'm using Node.js 0.12.0, and Zombie 2.5.1. Any help appreciated, thanks!

@cobbdb
Copy link

cobbdb commented Sep 23, 2015

I'm not sure what all those other options are for, but this works for me:

var Browser = require('zombie');
Browser.visit('http://google.com', function (err, browser) {
    console.log('Currently visiting ' + browser.location);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants