* Sets the files property of a given input element. * * @param {string} browsingContextId - The ID of the browsing context. * @param {string | ReferenceValue} element - The ID of the element or a ReferenceValue object representing the element. * @param {string | string[]} files - The fil
(browsingContextId, element, files)
| 84 | * @returns {Promise<void>} A promise that resolves when the files are set. |
| 85 | */ |
| 86 | async setFiles(browsingContextId, element, files) { |
| 87 | if (typeof element !== 'string' && !(element instanceof ReferenceValue)) { |
| 88 | throw Error(`Pass in a WebElement id as a string or a ReferenceValue. Received: ${element}`) |
| 89 | } |
| 90 | |
| 91 | const command = { |
| 92 | method: 'input.setFiles', |
| 93 | params: { |
| 94 | context: browsingContextId, |
| 95 | element: |
| 96 | typeof element === 'string' |
| 97 | ? new ReferenceValue(RemoteReferenceType.SHARED_ID, element).asMap() |
| 98 | : element.asMap(), |
| 99 | files: typeof files === 'string' ? [files] : files, |
| 100 | }, |
| 101 | } |
| 102 | await this.bidi.send(command) |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | async function updateActions(actions) { |
no test coverage detected