Need some help with datadriven file uploading

Hey everyone!

Recently, I have been testing a page where I can upload files. The thing is, sometimes I need to upload multiple files sometimes I need to upload PDF’s and other times I need to upload PNG or JPG files.

I am using an Excel sheet for all of my other tests, but I don’t know how I can make a file upload data driven using an Excel sheet. It’s kind of a chore to constantly add new files manually or switch file paths in Katalon itself.

Did anyone else also run into this issue? And if so, how did you work around it?

Thanks in advance!

Hello @Funkey

The following keyword allows you to upload multiple files. You can upload this path regardless of the file format.

@Keyword
def uploadFile2 ( **TestObject to,**  String filePath , String file , String file2) {
**WebUI.click(to)**
StringSelection ss = new StringSelection("""+filePath+"" " +"""+ file +"" "+ file2 );
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL)
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}

Hey @emine! Thanks for the keyword! Is it possible to set one file path and use an Excel spreadsheet to get the filenames?

Thanks in advance!

Hello @Funkey

I have a blog there is a data set on Katalon Studio so please have a spell about creating excel and pulling the data that says in excel.

My blog is in Turkish but I think you can understand by translating :slight_smile:

Sorry @emine that’s not exactly what I meant. Sorry for the inconvience. :shrimp:

What I meant was:

I already know how to make test data and I am already using it on my test, I just need a way to use the Excel file to upload images, not text. Do you think that’s possible?

hello @Funkey

But I don’t think it’s possible to upload images to excel content.
Sorry.

Hey just wanted to say thanks! For the keyword, but is there a specfic reason why the quotes are placed so strangely?

Also:

Getting an error since I can’t use a backslash for some reason

@Funkey Instead of single slash \ use double slash \\

hello @Funkey

Please type the file path \\\

Please write file path : C:\\User\\filename