Reputation: 15
I am new to protractor and I am try to validate the value in the text field. Below is my code
expect(element(by.model('myModelName')).getAttribute('value').toEqual('name'));
I am getting the below error
Message:
TypeError: Object [object Object] has no method 'toEqual'
Stacktrace:
TypeError: Object [object Object] has no method 'toEqual'
at null.<anonymous> (C:\IntegrationTesting\script\Spec.js:53:100)
I have done other validations based on by.bind with toEqual which, but this is the 1st time i am using this. I am not sure if my usage is correct. How can I get this working? Please help me...
Upvotes: 0
Views: 5499
Reputation: 26176
wrong brackets:
expect(element(by.model('myModelName')).getAttribute('value')).toEqual('name');
Upvotes: 0
Reputation: 8900
Put the toEqual() after the expect:
expect(element(by.model('myModelName')).getAttribute('value')).toEqual('name');
The format should be:
expect(locator.getSomething()).toEqual('expected value');
Upvotes: 3