@luminati-io/webdriverio8
Version:
Next-gen browser and mobile automation test framework for Node.js
31 lines (30 loc) • 1.31 kB
JavaScript
/**
* Send a sequence of key strokes to an element after the input has been cleared before. If the element doesn't need
* to be cleared first then use [`addValue`](/docs/api/element/addValue).
*
* :::info
*
* If you like to use special characters, e.g. to copy and paste a value from one input to another, use the
* [`keys`](/docs/api/browser/keys) command.
*
* :::
*
* <example>
:setValue.js
it('should set value for a certain element', async () => {
const input = await $('.input');
await input.setValue('test')
await input.setValue(123)
console.log(await input.getValue()); // outputs: '123'
});
* </example>
*
* @alias element.setValue
* @param {string | number} value value to be added
*
*/
export async function setValue(value) {
await this.clearValue();
return this.addValue(value);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0VmFsdWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbWFuZHMvZWxlbWVudC9zZXRWYWx1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQXlCRztBQUNILE1BQU0sQ0FBQyxLQUFLLFVBQVUsUUFBUSxDQUUxQixLQUFzQjtJQUV0QixNQUFNLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQTtJQUN2QixPQUFPLElBQUksQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLENBQUE7QUFDL0IsQ0FBQyJ9