Created
July 12, 2012 16:01
-
-
Save naholyr/3099026 to your computer and use it in GitHub Desktop.
Click on checkbox with CasperJS
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
casperjs test test-checkbox.js |
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
<!doctype html> | |
<html> | |
<head> | |
<title>coucou</title> | |
</head> | |
<body> | |
<input type="checkbox" id="coucou"> | |
</body> | |
</html> |
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
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(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works great!, Thanks.