I have a simple checkbox which I would like to check, using protractor (AngularJS).
I tried:
$('.checkbox-class-name').click();
But it does not help. The selector is working (finding my element), but no luck with the click. I also tried:
it('should test something if checkbox is checked', function (done) {
myPage.navigate();
$('.checkbox-class-name').click().then(function() {
//expect something here
done();
})
});
But it does not work (it is getting inside the 'then' but if I pause the browser I see that the checkbox is not checked)
What am I doing wrong?
EDIT my HTML code:
<div ng-if="vm._getTermsAndConditionsFlag()">
<input class="checkbox-class-name" id="checkbox-name"
ng-model="vm.termsAndConditionsChecked" type="checkbox">
<label for="checkbox-name" >I agree to the terms & conditions</label>
</div>