e2e-testing

How to catch the <mat-error> error message text content using Protractor

佐手、 提交于 2020-07-22 05:53:09
问题 I'm dealing with below element and having trouble with getting the error message text in to a variable. <mat-error _ngcontent-c16="" class="mat-error ng-star-inserted" id="error-email-required" role="alert" style=""> Email is a required field </mat-error> Catching the element is straight forward. var emailReqiredLabel = element(by.id('error-email-required')); I tried below options but all printing as >> visible error message is : [object Object] var errormsg = emailReqiredLabel.getText()