Reputation: 3004
Here is my code:
var casper = require('casper').create({
clientScripts: ["jquery.js"]
});
var URL = casper.cli.get(0);
casper.start(URL, function (){
casper.evaluate(function() {
$(".tm-price").html("123");
});
});
casper.then(function(){
this.capture('nn.png');
});
casper.run();
I wanna to change the ".tm-price"'s html to "123",and then capture the screen.
How ever after run it ,it only capture the screen before I change it,but not after I change it.
What's wrong with my code.Would you please help me?Thank you.
Upvotes: 0
Views: 426
Reputation: 606
Try to find out if the price is already there or you must wait for it to get filled.
This real world example works for me with no problem:
var casper = require('casper').create({
clientScripts: ["js/jquery.min.js"],
viewportSize: {
width: 1024,
height: 768
}
});
casper.start('http://stackoverflow.com', function() {
casper.evaluate(function() {
jQuery('#h-top-questions').html('Not Top Questions!');
});
});
casper.then(function() {
this.capture('capture.png', {
top: 0,
left: 0,
width: 1024,
height: 1000
});
});
casper.run();
Upvotes: 1