Created
August 23, 2012 17:07
-
-
Save codereflection/3438782 to your computer and use it in GitHub Desktop.
phantomjs with casperjs example
This file contains 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.casperPath = 'D:\\Dev\\Tools\\casperjs'; | |
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js'); | |
var casper = require("casper").create({ | |
logLevel: "debug" | |
}); | |
var utils = require('clientutils').create(); | |
casper.start("http://localhost:52125/ED/stockresearch/StockResearch", function() { | |
this.test.assertHttpStatus(200, "Page returned successfully"); | |
this.test.assertTitle("Stock Research", "stock research title is the one expected"); | |
}); | |
casper.then(function() { | |
this.test.assertExists("input[id='startDate']", "start date field found"); | |
this.test.assertExists("input[id='derpDate']", "derp date field found"); | |
var checkDivs = function() { | |
return $(".collapsibleSection.filterSectionLabel.additionalFilters").length; | |
}; | |
this.test.assertEvalEquals(checkDivs, 1, "found the Additional Filters div"); | |
this.test.comment("additional filters: "); | |
var additionalFilters = this.evaluate(function() { | |
return $(".collapsibleSection.filterSectionLabel.additionalFilters"); | |
}); | |
this.test.assertEquals(additionalFilters.length, 1, "got the additional filter back"); | |
this.test.assertEquals(additionalFilters, null, "should be a function"); | |
this.test.comment(utils.serialize(additionalFilters)); | |
}); | |
casper.run(function() { | |
this.test.renderResults(true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment