Uploading File using upload file statement

{
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.uploadFile(findTestObject('Object Repository/New Folder (1)/Page_BBC/div_CancelNextUpload CSV File'), 'C:\\Users\\HP\\Downloads\\Upload loans template 24d.csv')

}

Guys, I need help. I’m doing a Basic file upload using uploadFile keyword. However, always I get this error and no file are uploaded using katalon studio.


=============== ROOT CAUSE =====================

Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable

At object: 'Object Repository/New Folder (1)/Page_BBC/div_CancelNextUpload CSV File'

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html

================================================

01-28-2025 09:21:04 PM Test Cases/New Test Case (3)

Elapsed time: 4m - 30.664s

Test Cases/New Test Case (3) FAILED.

Reason:

com.kms.katalon.core.exception.StepFailedException: Unable to upload file 'C:\Users\HP\Downloads\Upload loans template 24d.csv' to object 'Object Repository/New Folder (1)/Page_BBC/div_CancelNextUpload CSV File'

at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:117)

at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:43)

at com.kms.katalon.core.webui.keyword.builtin.UploadFileKeyword.uploadFile(UploadFileKeyword.groovy:87)

at com.kms.katalon.core.webui.keyword.builtin.UploadFileKeyword.execute(UploadFileKeyword.groovy:68)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.uploadFile(WebUiBuiltInKeywords.groovy:4117)

at New Test Case (3).run(New Test Case (3):49)

at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)

at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)

at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:137)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:128)

at TempTestCase1738092061650.run(TempTestCase1738092061650.groovy:25)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable

(Session info: chrome=131.0.6778.265)

Build info: version: '3.141.59', revision: 'unknown', time: 'unknown'

System info: host: 'DESKTOP-HMH8AM7', ip: '192.168.0.109', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.7'

Driver info: com.kms.katalon.selenium.driver.CChromeDriver

Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 131.0.6778.265, chrome: {chromedriverVersion: 130.0.6723.69 (3ec172b971b9..., userDataDir: C:\Users\HP\AppData\Local\T...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:64630}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

Session ID: c9093fd3a450994801c8c2a1a67c8083

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)

at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)

at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)

at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:106)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.lambda$new$0(EventFiringWebDriver.java:404)

at jdk.proxy2/jdk.proxy2.$Proxy21.sendKeys(Unknown Source)

at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.sendKeys(EventFiringWebDriver.java:429)

at com.kms.katalon.core.webui.keyword.builtin.UploadFileKeyword$_uploadFile_closure1.doCall(UploadFileKeyword.groovy:80)

at com.kms.katalon.core.webui.keyword.builtin.UploadFileKeyword$_uploadFile_closure1.call(UploadFileKeyword.groovy)

at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:35)

... 18 more

This “question” has been asked many times on this forum. The last time the issue with uploading a file was the OP was not using an <input> object with <type> = ‘File’. I notice your object name starts with “div”, so maybe that is the situation again.

1 Like

ensure your UI is interactable before performing upload action

It would be helpful if the Katalon team could make this point clearer in the documentation - the keyword ONLY works with the correct html tag

1 Like

if you @rodinedaou are using XPATH, your xpath value should be looks like this:

//input[@type='file' and @accept='application/pdf,image/jpeg,image/jpg']

the element should be an input file

1 Like

Hi @rodinedaou,

Do you find the solution for your case? If yes, please help share and mark solution so that others can refer to. If no, please share more information to support or close this if you no longer work on it. Thank you