subirArchivo
Sube un archivo al servidor Selenium Standalone u otro controlador de navegador
(por ejemplo, Chromedriver o EdgeDriver) utilizando el comando file.
Nota: este comando solo es compatible si utilizas un Selenium Hub,
Chromedriver o EdgeDriver directamente.
Nota: este comando utiliza una característica no oficial del protocolo que actualmente solo es compatible en Chrome y cuando se ejecuta un Selenium Grid.
Uso
browser.uploadFile(localPath)
Parámetros
| Nombre | Tipo | Detalles | 
|---|---|---|
| localPath | string | ruta local al archivo | 
Ejemplo
uploadFile.js
import path from 'node:path'
it('should upload a file', async () => {
    await browser.url('https://the-internet.herokuapp.com/upload')
    const filePath = '/path/to/some/file.png'
    const remoteFilePath = await browser.uploadFile(filePath)
    await $('#file-upload').setValue(remoteFilePath)
    await $('#file-submit').click()
});
Retorna
- <String>
return: URL remota