You can write a fairly simple CSS selector:
element(by.css("input[formControlName=username]")).sendKeys('test@example.com');
Note that if you need to do this often, you can always define a custom locator:
by.addLocator('formControlName', function(value, opt_parentElement, opt_rootSelector) {
var using = opt_parentElement || document;
return using.querySelectorAll('[formControlName="' + value +'"]');
});
Using:
element(by.formControlName('username')).sendKeys('test@example.com');
source
share