@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
24 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.selectOption = void 0;
/*! https://github.com/webdriverio/cucumber-boilerplate/blob/master/src/support/action/selectOption.js */
/**
* Select an option of a select element
* @param {String} selectionType Type of method to select by (name, value or
* text)
* @param {String} selectionValue Value to select by
* @param {String} selector Element selector
*/
async function selectOption(selectionType, selectionValue, selector) {
const element = await $(selector);
if (selectionType === "text") {
await element.selectByVisibleText(selectionValue);
return;
}
if (selectionType !== "name" && selectionType !== "value") {
throw new Error(`Unknown selection type "${selectionType}"`);
}
await element.selectByAttribute(selectionType, selectionValue);
}
exports.selectOption = selectOption;
//# sourceMappingURL=selectOption.js.map