Reputation: 309
I have a dynamic attribute, which disappears once certain action is performed on it:
<input type="checkbox" checked="checked" class="includeUnclaimedChk">
For example, once this checkbox is unchecked, then checked="checked"
completely disappears from DOM. How can I verify this in Protractor?
What I have done currently is to verify this attribute is checked:
expect(page.isEnabledClaimedCheckbox).toBe("checked");
hasState is defined in POM file:
this.claimedCheckbox = browser.element(by.css('input[class="includeUnclaimedChk"]'));
this.isEnabledClaimedCheckbox= function() {
return this.claimedCheckbox.getAttribute('checked');
};
Upvotes: 1
Views: 382
Reputation: 9058
If the attribute is not present then null will be returned by getAttribute(). getAttribute() desc...
You can use the matcher - expect(page.isEnabledClaimedCheckbox).toBeNull()
.
Upvotes: 1