September 2018
Intermediate to advanced
764 pages
20h 6m
English
This scenario checks the disabled attribute as before, but this time testing that it is not set. Therefore, update our step definition at spec/cucumber/steps/assertions/index.js to take this into account:
When(/^the (?:"|')([\.#\w-]+)(?:"|') element should( not)? have a (?:"|')([\w_-]+)(?:"|') attribute$/, async function (selector, negation, attributeName) { const element = await this.driver.findElement(By.css(selector)); const attributeValue = await element.getAttribute(attributeName); const expectedValue = negation ? null : 'true'; assert.equal(attributeValue, expectedValue);});
Read now
Unlock full access