Protractor 'toContain' error
问题 This is my expect: expect(mandatoryFields[index].getAttribute('class')).toContain('error'); This is the error in console: Expected['formControl ng-pristine ng-untouched ng-valid ng-empty ng-valid-maxlength error'] to contain 'error'. Eventhough the class contains ERROR class name, protractor is still throwing error. What could be reason? Any help!!! 回答1: Instead of toContain try using toMatch . toContain is used to check whether the required value is present in an array or not. whereas