Set File
client.setFile((selector: string), (fileName: string));
The selector
parameter specifies input field element selector, e.g.
input[type="file"]
, input#file-upload
.
The fileName
parameter specifies chosen file name. Choose desired file from
the table below.
Available test files
File name (fileName ) | Type | Size |
---|---|---|
loaderoSample100KB.png | PNG | 100KB |
loaderoSample1MB.png | PNG | 1MB |
loaderoSample5MB.png | PNG | 5MB |
loaderoSample30MB.png | PNG | 30MB |
loaderoSample100MB.txt | TXT | 100MB |
In case there is a need for other file format or size, feel free to contact us.
client => {
// Example of uploading sample file into file input field using constants
client
// Open DemoQA upload/download page
.url("https://demoqa.com/upload-download")
// Wait for up to 10s for "Choose file" button to be visible
.waitForElementVisible('#uploadFile', 10 * 1000)
// Upload Loadero sample image
.setFile(
'#uploadFile',
loaderoConstants.sampleFiles.png100KB
)
.takeScreenshot("file_set.png")
}