Skip to content

Instantly share code, notes, and snippets.

@naholyr
Created July 12, 2012 16:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naholyr/3099026 to your computer and use it in GitHub Desktop.
Save naholyr/3099026 to your computer and use it in GitHub Desktop.
Click on checkbox with CasperJS
casperjs test test-checkbox.js
<!doctype html>
<html>
<head>
<title>coucou</title>
</head>
<body>
<input type="checkbox" id="coucou">
</body>
</html>
casper.start();
casper.open('http://localhost:8000/test.html');
casper.then(function(){
this.test.assertExists('#coucou');
this.click('#coucou');
this.wait(100, function() {
this.test.assert(this.evaluate(function () {
return document.getElementById('coucou').checked;
}));
});
});
casper.run(function(){
this.test.done();
});
@luiselizondo
Copy link

Works great!, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment