Skip to main content

setValue

Send a sequence of key strokes to an element (clears value before). If the element doesn't need to be cleared first then use addValue. You can also use unicode characters like Left arrow or Back space. WebdriverIO will take care of translating them into unicode characters. You’ll find all supported characters here. To do that, the value has to correspond to a key from the table. It can be disabled by setting translateToUnicode optional parameter to false.

Usage​
$(selector).setValue(value, { translateToUnicode })
Parameters​
NameTypeDetails
value
string, number, Array.<string, number>value to be added
options

optional
CommandOptionscommand options (optional)
options.translateToUnicode
booleanenable translation string to unicode value automatically
Example​
setValue.js
it('should set value for a certain element', async () => {
const input = await $('.input');
await input.setValue('test123');

console.log(await input.getValue()); // outputs: 'test123'
});