vendredi 29 janvier 2016

using protractor to get the disabled attribute on button not working

I'm trying to get the disabled attr on a button it should be "disabled" but I don't seem to be getting the value. New to angular and protractor!

When I inspect the page this is what HTML I get for the button showing disabled is disabled, like it is on the page:

 <button type="submit" class="button primary inverse" ng-disabled="!comment.$dirty && comment.$valid" disabled="disabled">Save</button>

The protractor test below returns 'Expected null to equal disabled'

    var btnSave = element(by.css('.primary'));
    expect(btnSave.isPresent()).toBeTruthy();

    var attr = element(by.css('.primary')).getAttribute('disabled');

    expect(attr).toEqual("disabled");

When I try I get expected '' to equal disabled.

expect(attr).toEqual("disabled");

Any ideas where I'm going wrong?

Thanks

Aucun commentaire:

Enregistrer un commentaire