In MEAN stack project I am using Selenium webdriver for frontend UI testing.
I have a field which is non editable. I have attached an image
How can I test this field making sure it cannot be edited?
it('not edit the field', () => {
login('amazonuser');
click(by.xpath('//mat-option[5]/span[contains(., "Amazon Id")]'));
getElement(by.xpath('//id-number/div/mat-form-field[2]/div/div[1]/div/input')).sendKeys('0');
logout();
});
You assert that the disabled
attribute is on the INPUT.
var input = element(by.xpath('//id-number/div/mat-form-field[2]/div/div[1]/div/input'))
expect(input.isEnabled()).toBe(true);
See the HTML docs.
See the Protractor docs.