# setFiles

Set the files of an `<input type="file">` with the WebDriver BiDi [`input.setFiles`](https://w3c.github.io/webdriver-bidi/#command-input-setFiles) command.

The paths are opened by the browser. They are not copied and not uploaded. A relative path is resolved against `process.cwd()`, so a path the test process can open is the path a local browser opens. A remote browser needs a path on the machine that runs the browser.

This command needs a BiDi session. On a classic session, [`setValue`](/docs/api/element/setValue.md) still types a path the local browser can already see.

Passing more than one path to an input without `multiple`, a disabled input, or an element that is not a file input fails with the BiDi error `unable to set file input`.

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

```
await $(selector).setFiles(files)
```

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

| Name    | Type               | Details                                    |
| ------- | ------------------ | ------------------------------------------ |
| `files` | `string, string[]` | path or paths the browser machine can read |

## Example[​](#example "Direct link to Example")

setFiles.js

```
it('sets a file input', async () => {

    await $('#file-upload').setFiles('/path/to/file.png')

    await $('#file-upload').setFiles(['/path/to/a.png', '/path/to/b.png'])

});
```
