I was trying to upload csv using setInputFiles command but getting a type error as Execution completed
Code:
const fileInput = import page.$(“locator”);
fileInput.setInputFiles(‘path of file’);
Output:
Uncaught (in promise) TypeError: Object has no member ‘setInputFiles’
I am using k6 version 0.52.
Hi @ankushakhotele1,
Please see this migration document. You need to use await
in front of $
and setInputFiles
.
Hope this helps.
I am also facing to Upload file, with doing 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 path with locator.
Playwright and Selenium works like that.
It’s because Locator
doesn’t have a setInputFiles
method (however, Page
, Frame
, ElementHandle
do—so you can also use the method on these objects). Please submit a new issue on our Github so that we can add this feature. Thanks!
1 Like
Thanks, @bandorko, I missed it