Facing challenges to Upload file, to do performance testing using k6.
Why cannot we use Playwright
await page.getByLabel(‘Upload file’).setInputFiles(path.join(__dirname, ‘myfile.pdf’));
or
await page.locator(“//input[@type=‘file’]”).setInputFiles(“C:/K6-Perform/sample-csv.csv”);
This line is giving me : Object has no member ‘setInputFiles’.
To upload a file we should just need file attribute locator and path of the file.After the Upload button click with do the rest. Playwright and Selenium works like that.
Uploading file is a basic test in load testing. I hope this features is added in k6, or atleast give support of playwright so we can do that using playwright .
Hi @korivnonse
setInputFiles is supported since v0.50.0 but for security reasons you can’t upload the file directly from the file system, but there is a workaround (see here)