@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
19 lines • 935 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setInputField = void 0;
/*! https://github.com/webdriverio/cucumber-boilerplate/blob/master/src/support/action/setInputField.js */
const checkIfElementExists_1 = require("../lib/checkIfElementExists");
/**
* Set the value of the given input field to a new value or add a value to the
* current element value
* @param {String} method The method to use (add or set)
* @param {String} value The value to set the element to
* @param {String} selector Element selector
*/
async function setInputField(method, value, selector) {
await (0, checkIfElementExists_1.checkIfElementExists)(selector, false, 1);
const command = method === "add" ? "addValue" : "setValue", element = await $(selector);
element[command](value || " ");
}
exports.setInputField = setInputField;
//# sourceMappingURL=setInputField.js.map