# setValue

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.md).

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.md) command with the [`Key`](/docs/api/modules.md#key) object.

## Usage[​](#usage "Direct link to Usage")

```
await $(selector).setValue(value, additional)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name         | Type             | Details                           |
| ------------ | ---------------- | --------------------------------- |
| `value`      | `string, number` | value to be added                 |
| `additional` | `InputOptions`   | options, exclusive to Webdriverio |

## Example[​](#example "Direct link to 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'
});
```
