Second time File Upload Issue

In My TestCase, I have 2 file upload boxes and I need to upload files using Katalon Automation at two file input boxes. I was using File upload Keyword which I found in one of the katalon forums ( Katalon Studio Native Popup Window and Upload File ).
When I run the TestCase for the first upload it was working perfectly fine but it was throwing an error that the file is not present for the second File upload even though the file exists.
Can anyone help me with this issue!!..
Thanks.

We are going to need more information:

1.) Please share your test script.
2.) Please share the error log.
3.) Please share the HTML of the two <input> elements in question.

Hi @Brandon_Hein
This is the test script which i have created to upload the files.

   WebUI.click(findTestObject('destructivetestingsuite/Date and Time Tipo/button_addCreate'))

    WebUI.delay(5)

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/f1/f1'))

    WebUI.delay(0)

    CustomKeywords.'packageupload.uploadclass.uploadFile'(findTestObject('destructivetestingsuite/File Field Type/f1/f1 div_insert_drive_file Public'), 
        'C:\\Users\\admin\\Desktop\\Katalon File Uploads\\images.jpg')

    WebUI.delay(5)

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/f1/f1 button_Start Upload'))

    WebUI.delay(5)

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/Page_Effortless SaaS Products/div_Basic tab'))

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/Page_Effortless SaaS Products/div_Basic tab'))

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/f2/f2'))

    WebUI.delay(3)

    WebUI.delay(3)

    CustomKeywords.'packageupload.uploadclass.uploadFile'(findTestObject('destructivetestingsuite/File Field Type/f2/f2 div_insert_drive_file Public'),'C:\\Users\\admin\\Desktop\\Katalon File Uploads\\images.jpg')

    WebUI.delay(5)

    WebUI.click(findTestObject('destructivetestingsuite/File Field Type/f2/button_Start Upload'))

There was no error log. The test case was getting successful without any errors but actually it was unable to upload the file in the second file upload input.

I have uploaded two screenshots the first screenshot is the place where it was getting failed(it was unable to find the file even though the file exists). I have also attached another screenshot to show you that the first file upload was successful and for the second field it was unable to upload.
I have also attached another screenshot of katalon log to show that there was no error in the testcase.

Thanks

Ok thank you. One last thing, can you share the following two test objects?:

destructivetestingsuite/File Field Type/f1/f1 div_insert_drive_file Public
destructivetestingsuite/File Field Type/f2/f2 div_insert_drive_file Public

My guess is that the same field is being located twice.

1 Like

Hi @Brandon_Hein
Yes, both have the same object because its a popup box where we upload the file and it will always have the unique field.
/html/body/div[4]/div[2]/div/mat-dialog-container/tp-file-dialog-content/mat-dialog-content/div/div/button/input

Thanks.

Try changing this to:

//input[@name='qqfile']

Hi @Brandon_Hein
yes, I have tried by giving id too.
//*[@id="manualBBrowseButton"]/input
Even with this, the result is the same.

Hi @Brandon_Hein
Tried the same way as you suggested but still it didn’t work.

Ok it might be the keyword that’s the problem. I would try using a different keyword. See this topic on how to use the sendKeys() keyword instead:

Hello, i’m facing this same issue does anyone know what is the solution? Thanks in advance.

Hello, I am also facing the same issue when uploading file for the second time.

Are you using the custom keyword described above, which makes use of Robot? Have you tried the built-in File Upload keyword from Katalon? [WebUI] Upload File | Katalon Docs?

Yes…custom keyword using Robot.