Created
May 20, 2011 18:50
-
-
Save erithmetic/983528 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zombie = require("zombie"); | |
var assert = require("assert"); | |
zombie.visit("http://www.orbitz.com/", function (err, browser, status) { | |
console.log(browser.window.location.href); | |
console.log(browser.html()); | |
browser. | |
clickLink('#flightsTab', function(error, browser) { | |
browser. | |
fill("airOrigin", "DTW"). | |
fill("airDestination", "SFO"). | |
fill("airStartDate", "06/11/2011"). | |
fill("airEndDate", "06/17/2011"). | |
pressButton("Find Flights", function(error, browser) { | |
assert.ok( | |
browser.text(). | |
match(/Emission estimates powered by Brighter Planet/) > 0); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
caladan:careplane dkastner$ node zombie.js | |
http://www.orbitz.com/App/ViewDHTMLCalendar?z=bd8&r=o | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<style type="text/css"> | |
@import url("/shared/css/calendar.css.jsp?cache=20041122"); | |
</style> | |
<script type="text/javascript"> | |
function initCalDates() { | |
var mbDateToday = "May 20, 2011"; | |
var mbDateMax = "April 14, 2012"; | |
if ((!(mbDateToday.length)) || (!(mbDateMax.length))) { | |
var calBackupToday = new Date(); | |
var calBackupMax = new Date(); | |
mbDateToday = calBackupToday.toString(); | |
calBackupMax.setTime(calBackupToday.getTime() + (330 * 86400 * 1000)); | |
mbDateMax = calBackupMax.toString(); | |
} | |
parent.calendar.init(window, document, document.getElementById('calendar'), mbDateToday, mbDateMax); | |
} | |
</script> | |
</head> | |
<body onload="javascript:initCalDates();" class="hidden" id="calendarBody"> | |
<div id="calendar"> </div> | |
</body> | |
</html> | |
node.js:134 | |
throw e; // process.nextTick error, or 'error' event on first tick | |
^ | |
TypeError: Cannot call method 'fill' of undefined | |
at /Users/dkastner/careplane/zombie.js:11:9 | |
at Browser.clickLink (/usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/browser.js:299:16) | |
at /Users/dkastner/careplane/zombie.js:9:5 | |
at /usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/browser.js:266:20 | |
at Browser.<anonymous> (/usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/browser.js:156:18) | |
at Browser.<anonymous> (/usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/browser.js:9:60) | |
at Browser.emit (events.js:64:17) | |
at EventLoop.<anonymous> (/usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/eventloop.js:142:26) | |
at Array.<anonymous> (/usr/local/lib/node/.npm/zombie/0.9.5/package/lib/zombie/eventloop.js:2:61) | |
at EventEmitter._tickCallback (node.js:126:26) | |
caladan:careplane dkastner$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment