Set File

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)TypeSize
loaderoSample100KB.pngPNG100KB
loaderoSample1MB.pngPNG1MB
loaderoSample5MB.pngPNG5MB
loaderoSample30MB.pngPNG30MB
loaderoSample100MB.txtTXT100MB

In case there is a need for other file format or size, feel free to contact us.

function(browser) {
    // Example of setting sample file into file input field using string values
    browser
        .url('https://www.myawesomepage.com')
        .waitForElementVisible('body', 10 * 1000)
        .setFile('input#file-upload', 'loaderoSample100KB.png')
        .pause(1000)
        .takeScreenshot('fileSet.png');
}
function(browser) {
    // Example of setting sample file into file input field using constants
    browser
        .url('https://www.myawesomepage.com')
        .waitForElementVisible('body', 10 * 1000)
        .setFile('input#file-upload', loaderoConstants.sampleFiles.png100KB)
        .pause(1000)
        .takeScreenshot('fileSet.png');
}