webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
31 lines • 1.33 kB
TypeScript
/**
* 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)
* 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`.
*
* <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'])
});
* </example>
*
* @alias element.setFiles
* @param {string|string[]} files path or paths the browser machine can read
* @type utility
* @uses protocol/inputSetFiles
*/
export declare function setFiles(this: WebdriverIO.Element, files: string | string[]): Promise<void>;
//# sourceMappingURL=setFiles.d.ts.map