Created
July 6, 2012 19:14
-
-
Save npow/3062214 to your computer and use it in GitHub Desktop.
CasperJS Demo
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
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js'); | |
var casper = require('casper').create(); | |
casper.start('http://localhost:1200/charts/ChartWrapperTest.htm', function() { | |
// setup options here | |
this.evaluate(function () { | |
document.getElementById('chartType').value = 4; | |
}); | |
}); | |
casper.then(function() { | |
this.click('#drawButton'); | |
this.echo("CLICKED"); | |
}); | |
casper.waitFor(function check() { | |
this.echo("HERE"); | |
return this.evaluate(function() { | |
return window.chartObj.chartIsDrawn && window.imgReturned; | |
}); | |
}, function then() { | |
this.echo("THEN"); | |
this.captureSelector('left_chart.png', '#chartHolder'); | |
this.captureSelector('right_chart.png', '#chartImgHolder'); | |
}, function timeout() { | |
this.echo("TIMEOUT"); | |
}, 5000); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment