I have an issue with Casper JS and a sample html page.
The onLoad event on the external bootstrap call that i added dynamically is not triggered/handled on casper side. In my example, the screenshot will never be red but if i load the page from a browser then the page does look red.
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<script type="text/javascript">
var s = document.createElement("link");
s.href = "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css";
s.rel = "stylesheet";
s.type = "text/css";
document.body.appendChild(s);
s.onload = function(){
document.body.style.backgroundColor = "red";
};
</script>
</body>
</html>
Here is the file called by casper:
var casper = require('casper').create();
casper.start('test.html', function() {
});
casper.wait(5000, function(){
casper.capture("debug.png");
});
casper.run(function() {
});
Am I missing something?