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 setting sample file into file input field using constants
client
.url("https://images.google.com/")
// Navigate to upload image view
.waitForElementVisible('div[aria-label="Search by image"]', 10 * 1000)
.click('div[aria-label="Search by image"]')
.waitForElementVisible('a[href="about:invalid#zClosurez"]', 10 * 1000)
.click('a[href="about:invalid#zClosurez"]')
.waitForElementVisible('input[name="encoded_image"]', 10 * 1000)
// Upload Loadero sample image
.setFile(
'input[name="encoded_image"]',
loaderoConstants.sampleFiles.png100KB
)
.takeScreenshot("file_set.png")
.waitForElementVisible("div#res", 10 * 1000)
.takeScreenshot("search_by_image_results.png");
}