Skip to content

Latest commit

 

History

History

select-files

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

selectFiles(element, ...filePaths)

Select files for a file input element

Example

import { openBrowser, openTab, findElement, selectFiles } from 'puppet-strings'

async function run() {
  const browser = await openBrowser('google-chrome')
  const tab = await openTab(browser, 'https://www.npmjs.com/')

  const fileInput = await findElement(tab, 'input[type="file"]')
  await selectFiles(fileInput, '/tmp/file1.txt', '/tmp/file2.txt')
}
run()

Parameters

  • element (Element)
  • ...filePaths (Array)

Returns

  • promise (Promise)

Details

selectFiles populates a file input element with one or more files. Paths to the files may be absolute or relative to the current working directory.