mercredi 17 juin 2020

After clicking the button, how do I test that the button is disabled using protractor?

I want to check the button which clicked is disabled after clicking the button, but I get an error following:

NoSuchElementError: No element found using locator: By(css selector, *[id="saveButton"])

Protractor:

const saveButton = await element(by.id('saveButton'));
saveButton.click();
browser.sleep(1000);
await expect(saveButton.isEnabled()).to.be.false;

HTML:

<button id="saveButton" mat-button (click)="saveArticle()" [disabled]="isDisable">Save</button>

Angular:

saveArticle() {
    this.isDisable = true;
}

The button visible on screen and protractor finds and clicks the button, but after that an error occurs like above. How can I check the button is disabled after clicking

Aucun commentaire:

Enregistrer un commentaire