Drag and Drop File or UploadFile doesn't work for multiple files

We’ve spent about 2-3 days now trying to figure this out.
I want the test to upload multiple files at the same time either by draganddrop from filepath or by fileUpload method.

I’ve tried several methods and none of them seem to work for bulk upload. Uploading the files individually works fine, but doing it bulk breaks it.

These are the two codeblock that we are certain SHOULD work but doesn’t.

codeblock 1 - in this case, we tried both the upload button, or the drag&drop area.

def list = ['QA_pdf.pdf', 'QA_docx.docx', 'QA_pp.pptx']

def dir = new File("C:\\Users\\ashra\\Desktop\\All Files\\")
	dir.eachFile (FileType.FILES) { file ->
	list << file
}

for (item in list) {
WebUI.uploadFile(findTestObject('Page_File Storage/*button_Or Click to Select*'), item, 
	FailureHandling.STOP_ON_FAILURE)
}

method #2-

def list = ['QA_pdf.pdf', 'QA_docx.docx', 'QA_pp.pptx']

def dir = new File("C:\\Users\\ashra\\Desktop\\All Files\\")
	dir.eachFile (FileType.FILES) { file ->
	list << file
}

for (item in list) {
WebUI.uploadFileWithDragAndDrop(('Page_File Storage Integrations/div_Drag and Drop area'), item, 
	FailureHandling.STOP_ON_FAILURE)
}

both of these methods returns error. method 2 seems to return files not found but it’s vaguely similar.

image

also tried a simpler method… by defining the filepaths

def allFilePath = (filePath + '\n' + filePath2 + '\n' + filePath3 + '\n' + filePath4)

WebUI.uploadFileWithDragAndDrop(('Page_File Storage Integrations/div_Drag and Drop area'), 
	allFilePath, 
		FailureHandling.STOP_ON_FAILURE)

@ThanhTo any solution to this?
I need to upload multiple files from desktop (bulk upload) to the drag&drop area but it isn’t working with several methods i’ve tried above.
image

@ashraf.madina Have you searched the forums for solutions to this? There are several topics which solve this problem already. Give this one a try:

Specifically, check my “Bonus Step” section.

that likely only works if there’s an input upload element on the page, it didn’t work

Well, is there an <input>? I’ve never seen a file upload field that wasn’t.

Please share the HTML for your field if possible.

the picture of the drag and drop area and button is posted above.

There is an input in the html but it’s layered - this is cuz of React styling library. image

<input type=file...>

THAT is an input.

it’s nested, layered - it’s React libraries. that’s how styling libraries work for React front-end. That means it’s literally hidden in the UI and for automation

Doesn’t matter if it’s hidden. Doesn’t matter what framework it is. THAT IS YOUR INPUT.

Sorry to shout but you seem to need convincing. Ditch whatever baggage you have regarding frameworks and see the page as what it is: HTML, CSS and JavaScript. Everything else is just window-dressing.

As Russ said, all that matters here is the HTML. Your web page could literally just be an image of a potato, and have all sorts of actual architecture underneath.

So, I’ll refer you back to my topic now that hopefully that makes sense: