how to check if an element is enabled

angularjs, protractor

Solution

The parenthesis is misplaced in the `expectation` :

expect(submit.isEnabled().toBe(false));

it should be :

expect(submit.isEnabled()).toBe(false);

And you misuse the `protractor locator` :

submit = by.id('submitButton');

it should be :

submit = element(by.id('submitButton'));

You could find a lot of examples in the specs of protractor.

Problem

I need to check with Protractor if a button in my angular application is enabled, for so this is my test: ``` it('submit should not be enabled',function() { var price = by.name('price'), oldCategory = by.name('oldCategory'), newCategory = by.name('newCategory'), oldPayment = by.name('oldPayment'), newPayment = by.name('newPayment'), item = by.name('item'), submit = by.id('submitButton'); expect(submit.isEnabled().toBe(false)); }); ``` when I run the test, get this error: ``` TypeError: Object By.name("price") has no method 'isEnabled' ```

Original source