# Upload file not working

**URL:** <https://forum.katalon.com/t/upload-file-not-working/62310>\
**Category:** Miscellaneous\
**Tags:** new-doc-request\
**Created:** [February 7, 2022, 10:58pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310 "2022-02-07T22:58:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 7, 2022, 10:58pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/1 "2022-02-07T22:58:12Z")

</div>

Hello Group,

I’m trying to upload a file, when I run the test, it clicks on link but won’t go to where the file is at and upload it. I’m getting this error message, before when I got a similar error in a different test, I added delays, mouse over to my code.

thanks  
=============== ROOT CAUSE =====================  
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable  
At object: ‘Object Repository/Final report/Page\_125 Beech St Orders Anow/label\_Upload final report’

here is my code

 ![test 1](https://europe1.discourse-cdn.com/katalon/original/3X/2/5/25f63a5777604a45875d3fa9673136914fa600db.png) ![test 2](https://europe1.discourse-cdn.com/katalon/original/3X/0/1/01285e40428c39adeded8b4a97a9b17290017db0.png)

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [February 8, 2022, 3:44am UTC](https://forum.katalon.com/t/upload-file-not-working/62310/2 "2022-02-08T03:44:08Z")

</div>

Hi @alex.tapia, Try this: [How-to use ‘sendKeys’ or 'File Upload' to upload files](http://forum.katalon.com/t/how-to-use-sendkeys-or-file-upload-to-upload-files/54758)

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 8, 2022, 3:54pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/3 "2022-02-08T15:54:26Z")

</div>

i followed those steps and now im getting this error when i change the element to selection method to attributes.

//_[(text() = ‘Upload final report’ or . = ‘Upload final report’) and @type = ‘file’ and @id = '//_[@id = ‘uploadDocument’ and @type = ‘file’]’]

=============== ROOT CAUSE =====================  
Caused by: org.openqa.selenium.InvalidArgumentException: invalid argument

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [February 9, 2022, 5:47am UTC](https://forum.katalon.com/t/upload-file-not-working/62310/4 "2022-02-09T05:47:21Z")

</div>

See these examples:

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 9, 2022, 9:26pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/5 "2022-02-09T21:26:33Z")

</div>

those videos were very helpful, I finally got everything to work. do you know if drag and drop will work the same ?

thanks  
go49ers

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [February 10, 2022, 3:06am UTC](https://forum.katalon.com/t/upload-file-not-working/62310/6 "2022-02-10T03:06:56Z")

</div>

Any //input[@type,‘file’] object should work.

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 10, 2022, 5:49pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/7 "2022-02-10T17:49:00Z")

</div>

when I was looking for the previous input id i found this and it worked  
//\*[@id=“finalReportUpload”]

input type=“file” id=“finalReportUpload” class=“attachments-upload\_\_fileInput”

but now that I’m looking for the browse/drag and drop section i dont see the input id I see this

input type=“file” multiple="" autocomplete=“off” style=“position: absolute; inset: 0px; opacity: 1e-05; pointer-events: none;”

should I use this  
//\*[@id=“multiple autocomplete”]

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 10, 2022, 9:12pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/8 "2022-02-10T21:12:22Z")

</div>

Can I ask where you get this?  
` //*[@id="multiple autocomplete"]`

from this

```auto
input type="file" multiple="" autocomplete="off" style="position: absolute; inset: 0px; opacity: 1e-05; pointer-events: none;"

```

or is there an actual **id** attribute that has the data, “multiple autocomplete”, like you did with this:

```auto
input type="file" id="finalReportUpload" class="attachments-upload__fileInput"

```

`//*[@id="finalReportUpload"]`

If there is not, you can’t just make things up–the computer won’t find it. You can ask for assistance on making a pathway to an element. We may need more information than is currently provided to ensure an **unique** pathway.

Maybe like:  
`//input[@type="file" and @multiple="" and @autocomplete="off"]`

Note: You can also start at another element and make a pathway to this one. Again, we would need more information than is currently provided to ensure an **unique** pathway.

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 10, 2022, 10:37pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/9 "2022-02-10T22:37:30Z")

</div>

here is some more code  
button class=“btn-clear attachments-upload\_\_link” type=“button”\>BROWSE.\</button

 ![Screenshot 2022-02-10 173421](https://europe1.discourse-cdn.com/katalon/original/3X/0/4/044a9f4f86b496cfc4f785204bfe9db2fbc217be.png)

the only thing that has an input id is this code, which is for the only visible to admin staff but its not clickable  
\<input type=“checkbox” name=“private” id=“privateFile”

i can add these steps to my test click the visible area and //\*[@id=“privateFile”]

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 10, 2022, 10:53pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/10 "2022-02-10T22:53:54Z")

</div>

> [@](#):
>
> button class=“btn-clear attachments-upload\_\_link” type=“button”\>BROWSE.\</button

You can try to use the below to see if that works for your Drag & Drop, but I don’t know if it’s the only one on the page:

```auto
//button[text()="BROWSE."]

```

or maybe click on this element and then use Robot or upLoadFile() to attach the file.

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 11, 2022, 8:26pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/11 "2022-02-11T20:26:24Z")

</div>

on our site, it has upload section called final report which works with //\*[@id=“finalReportUpload”]

but when i tried to drag and drop/browse section im getting an error  
ive searched

> [@grylion54](#):
>
> //button[text()=“BROWSE.”]

i’ve even used //\*[@id=“privateFile”]  
I’ve tried that and it still doesn’t work. it will open the download link but wont upload the file i need.

here is my variable  
variable is file-string-C:\xxxx\xxx\OneDrive\Documents\Test.pdf  
my code

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint  
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase  
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData  
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject  
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject  
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint  
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW  
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile  
import com.kms.katalon.core.model.FailureHandling as FailureHandling  
import com.kms.katalon.core.testcase.TestCase as TestCase  
import com.kms.katalon.core.testdata.TestData as TestData  
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW  
import com.kms.katalon.core.testobject.TestObject as TestObject  
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS  
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI  
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows  
import internal.GlobalVariable as GlobalVariable  
import org.openqa.selenium.Keys as Keys

WebUI.callTestCase(findTestCase(‘Just Login’), [:], FailureHandling.STOP\_ON\_FAILURE)

WebUI.click(findTestObject(‘Mark as Rush and Print/a\_Quick ViewReport In Progress25ATAlexTapia\_aa8f35’))

WebUI.uploadFile(findTestObject(‘upload file/Page\_12 York St Orders Anow/Browse -drag and drop’), file)

WebUI.click(findTestObject(‘upload file/Page\_12 York St Orders Anow/button\_BROWSE’))

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 11, 2022, 8:34pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/12 "2022-02-11T20:34:12Z")

</div>

![Screenshot 2022-02-11 153338](https://europe1.discourse-cdn.com/katalon/original/3X/6/e/6eefbd95a649c77c44cdadd0230bab4185b2178e.png)

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 11, 2022, 9:14pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/13 "2022-02-11T21:14:09Z")

</div>

What was the error you were getting?

I notice that you are getting **three** references back with your `//input[@type="file"]`. Can you add anything to your path to make it so you only get **one** reference back?

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 11, 2022, 9:22pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/14 "2022-02-11T21:22:02Z")

</div>

what do you recommend

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 11, 2022, 9:25pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/15 "2022-02-11T21:25:50Z")

</div>

Are there any references nearby that have an **id** like you used for “finalReportUpload”? If there are, then you may be able to traverse a pathway from there to the element you want. An **id** tag is supposed to be unique and that’s why I suggest it.

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 11, 2022, 9:33pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/16 "2022-02-11T21:33:00Z")

</div>

the only thing that has an input id is this code, which is for the only visible to admin staff but its not clickable  
\<input type=“checkbox” name=“private” id=“privateFile”

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 11, 2022, 11:13pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/17 "2022-02-11T23:13:57Z")

</div>

Is it possible to see the relationship (the HTML) of the `id=“privateFile”` to the element you want?

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [February 12, 2022, 8:20am UTC](https://forum.katalon.com/t/upload-file-not-working/62310/18 "2022-02-12T08:20:07Z")

</div>

Try picking the object with (//input[@type=“file”])[1] or (//input[@type=“file”])[2] or (//input[@type=“file”])[3]

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 14, 2022, 4:29pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/19 "2022-02-14T16:29:05Z")

</div>

> [@Dave\_Evers](#):
>
> (//input[@type=“file”])[1]

i tried all 3 with the same results

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/upload file/Page\_12 York St Orders Anow/Browse -drag and drop’ located by ‘(//input[@type=“file”])[3]’ not found

---

<div class="post-metadata">

**Author:** ![alex.tapia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/alex.tapia/32/16104_2.png) [@alex.tapia](https://forum.katalon.com/u/alex.tapia)\
**Post date:** [February 14, 2022, 4:42pm UTC](https://forum.katalon.com/t/upload-file-not-working/62310/20 "2022-02-14T16:42:28Z")

</div>

hope this helps

 ![Screenshot 2022-02-14 114149](https://europe1.discourse-cdn.com/katalon/original/3X/4/4/44bd1a9147d664941016ad48c0c980facd39fb5f.png)

[Next page](https://forum.katalon.com/t/upload-file-not-working/62310.md?page=2)
