Upload file not working

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.

=============== 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

Hi @alex.tapia, Try this: How-to use ‘sendKeys’ or 'File Upload' to upload files

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

See these examples:

1 Like

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


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

when I was looking for the previous input id i found this and it worked

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”]

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

from this

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:

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


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.

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

Screenshot 2022-02-10 173421

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”]

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:


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

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

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’))

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?

what do you recommend

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.

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”

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

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

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

hope this helps