# Second time File Upload Issue

**URL:** <https://forum.katalon.com/t/second-time-file-upload-issue/41703>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [March 31, 2020, 7:26am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703 "2020-03-31T07:26:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![srianoop.d](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/srianoop.d/32/16104_2.png) [@srianoop.d](https://forum.katalon.com/u/srianoop.d)\
**Post date:** [March 31, 2020, 7:26am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/1 "2020-03-31T07:26:25Z")

</div>

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](http://forum.katalon.com/t/katalon-studio-native-popup-window-and-upload-file/19386) ).  
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.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [March 31, 2020, 3:49pm UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/2 "2020-03-31T15:49:53Z")

</div>

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.

> [@\[TIP\] How To Help Us Help You!](http://forum.katalon.com/t/tip-how-to-help-us-help-you/12919):
>
> My test is BROKEN! NOTHING WORKS! HELP ME! Relax. We get it. We really do. There are some pretty smart and clever people on this forum, but you must realize, they are not magicians or wizards or gods. They cannot see your code, they can’t see your errors and they don’t even know what your AUT is meant to do even though it might seem perfectly obvious to you. So please relax and follow the advice below, before you start writing your post. The advice below will tell you the exact information …

---

<div class="post-metadata">

**Author:** ![srianoop.d](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/srianoop.d/32/16104_2.png) [@srianoop.d](https://forum.katalon.com/u/srianoop.d)\
**Post date:** [April 2, 2020, 6:53am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/3 "2020-04-02T06:53:09Z")

</div>

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.

 ![Screenshot (57)](https://europe1.discourse-cdn.com/katalon/original/2X/9/9dbf363d662d86e223d1889c3ba017cb8e3cc0e3.png) ![Screenshot (58)](https://europe1.discourse-cdn.com/katalon/original/2X/6/630584b9d963ff4d81bc5a709510510aa94cd1b1.png)

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.

 ![Screenshot (50)](https://europe1.discourse-cdn.com/katalon/original/2X/f/f5b7dc29f458f00fa01f6a58dcae4dcf6eefc154.png)

Thanks

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [April 2, 2020, 3:20pm UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/4 "2020-04-02T15:20:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![srianoop.d](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/srianoop.d/32/16104_2.png) [@srianoop.d](https://forum.katalon.com/u/srianoop.d)\
**Post date:** [April 3, 2020, 3:46am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/5 "2020-04-03T03:46:18Z")

</div>

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`

 ![Screenshot (54)](https://europe1.discourse-cdn.com/katalon/original/2X/6/6f48744c34208b4255becff2dad0a8cf03484534.png)

Thanks.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [April 3, 2020, 4:09am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/6 "2020-04-03T04:09:09Z")

</div>

> [@srianoop.d](#):
>
> `/html/body/div[4]/div[2]/div/mat-dialog-container/tp-file-dialog-content/mat-dialog-content/div/div/button/input`

Try changing this to:

`//input[@name='qqfile']`

---

<div class="post-metadata">

**Author:** ![srianoop.d](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/srianoop.d/32/16104_2.png) [@srianoop.d](https://forum.katalon.com/u/srianoop.d)\
**Post date:** [April 3, 2020, 4:22am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/7 "2020-04-03T04:22:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![srianoop.d](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/srianoop.d/32/16104_2.png) [@srianoop.d](https://forum.katalon.com/u/srianoop.d)\
**Post date:** [April 3, 2020, 8:39am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/8 "2020-04-03T08:39:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [April 3, 2020, 12:51pm UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/9 "2020-04-03T12:51:36Z")

</div>

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:

> [@How to Resolve File Upload Issues](http://forum.katalon.com/t/how-to-resolve-file-upload-issues/29812):
>
> I’ve been seeing several topics around issues with uploading files to a web application when using the WebUI.uploadFile() method, so I thought I’d share the best alternative approach (note: this is the same approach that one would take in Selenium as well): Step 1: Identify the file upload field Lets take a typical file upload field: [image] What we want is the \<input\> element for the field, which will look something like this (with probably a bunch of other attributes): \<input type="file" …

---

<div class="post-metadata">

**Author:** ![kimjayluta0721](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kimjayluta0721/32/16104_2.png) [@kimjayluta0721](https://forum.katalon.com/u/kimjayluta0721)\
**Post date:** [February 19, 2021, 1:21pm UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/10 "2021-02-19T13:21:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sheeja.pillai](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sheeja.pillai/32/22419_2.png) [@sheeja.pillai](https://forum.katalon.com/u/sheeja.pillai)\
**Post date:** [February 9, 2023, 6:55am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/11 "2023-02-09T06:55:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dan\_Bown](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dan_bown/32/20464_2.png) [@Dan\_Bown](https://forum.katalon.com/u/Dan_Bown)\
**Post date:** [February 9, 2023, 4:40pm UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/12 "2023-02-09T16:40:40Z")

</div>

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](https://docs.katalon.com/docs/author/keywords/keyword-description-in-katalon-studio/web-ui-keywords/webui-upload-file)?

---

<div class="post-metadata">

**Author:** ![sheeja.pillai](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sheeja.pillai/32/22419_2.png) [@sheeja.pillai](https://forum.katalon.com/u/sheeja.pillai)\
**Post date:** [February 10, 2023, 8:17am UTC](https://forum.katalon.com/t/second-time-file-upload-issue/41703/13 "2023-02-10T08:17:03Z")

</div>

Yes…custom keyword using Robot.
