# WebUI uploadFile failed

**URL:** <https://forum.katalon.com/t/webui-uploadfile-failed/33969>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [September 30, 2019, 6:34pm UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969 "2019-09-30T18:34:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hinpham](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hinpham](https://forum.katalon.com/u/hinpham)\
**Post date:** [September 30, 2019, 6:34pm UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/1 "2019-09-30T18:34:31Z")

</div>

I try to use WebUI uploadFile keyword but can’t make it work.

For example, my testObject is ‘Configuration/Client/div\_insert\_photo’

On my script, I verify the testObject by:  
_WebUI.verifyElementPresent(findTestObject(‘Configuration/Client/div\_insert\_photo’), 2)_  
or  
_text = WebUI.getText(findTestObject(‘Configuration/Client/div\_insert\_photo’))_  
or even click on the object, this will bring the browser to choose the file for uploading  
_WebUI.click(findTestObject(‘Configuration/Client/div\_insert\_photo’))_

But it always failed when I try to to use uploadFile keyword to this testObject:  
_WebUI.uploadFile(findTestObject(‘Configuration/Client/div\_insert\_photo’), ‘/Users/[myhome]/resources/data/desktop.jpg’, \_  
\_ FailureHandling.CONTINUE\_ON\_FAILURE)_  
or also failed with sendKeys keyword  
_WebUI.sendKeys(findTestObject(‘Configuration/Client/div\_insert\_photo’), ‘/Users/[myhome]/resources/data/desktop.jpg’, \_  
\_ FailureHandling.CONTINUE\_ON\_FAILURE)_

with error:

2019-09-30 10:52:55.783 DEBUG M-104 Client Configuration - Upload Logo - 9: uploadFile(findTestObject(“Configuration/Client/div\_insert\_photo”), “/Users/[myhome]/resources/data/desktop.jpg”, CONTINUE\_ON\_FAILURE)

2019-09-30 10:52:56.273 ERROR c.k.k.core.keyword.internal.KeywordMain - ❌ Unable to upload file ‘/Users/[myhome]/resources/data/desktop.jpg’ to object ‘Object Repository/Configuration/Client/div\_insert\_photo’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to upload file ‘/Users/[myhome]/resources/data/desktop.jpg’ to object ‘Object Repository/Configuration/Client/div\_insert\_photo’

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

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

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:56)

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

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$uploadFile$2.call(Unknown Source)

at Client Configuration - Upload Logo.run(Client Configuration - Upload Logo:33)

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.RawTestScriptExecutor.runScript(RawTestScriptExecutor.java:34)

at com.kms.katalon.core.main.RawTestScriptExecutor.doExecute(RawTestScriptExecutor.java:29)

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

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

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

at com.kms.katalon.core.main.TestCaseMain.runTestCaseRawScript(TestCaseMain.java:151)

at com.kms.katalon.core.main.TestCaseMain$runTestCaseRawScript$0.call(Unknown Source)

at TempTestCase1569865969245.run(TempTestCase1569865969245.groovy:64)

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

(Session info: chrome=77.0.3865.90)

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’

System info: host: ‘MY-MAC’, ip: ‘xxxxxx%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86\_64’, os.version: ‘10.14.6’, java.version: ‘1.8.0\_181’

Driver info: com.kms.katalon.core.webui.driver.ExistingRemoteWebDriver  
…

If anyone has any idea about this error? thank much in advance

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [October 1, 2019, 7:59am UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/2 "2019-10-01T07:59:05Z")

</div>

> [@hinpham](#):
>
> Configuration/Client/div\_insert\_photo

What is the type (HTML tag) of this object `Configuration/Client/div_insert_photo`?

---

<div class="post-metadata">

**Author:** ![emine](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/emine/32/15639_2.png) [@emine](https://forum.katalon.com/u/emine)\
**Post date:** [October 1, 2019, 2:49pm UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/3 "2019-10-01T14:49:47Z")

</div>

Hello @hinpham

Please you can look below link.

> [@Katalon Studio Native Popup Window and Upload File](http://forum.katalon.com/t/katalon-studio-native-popup-window-and-upload-file/19386):
>
> In this article, I would like to mention the solution I found regarding uploading any local file in the test step during the test with Native Popup Window. All the objects we record with the record in the test case are the descriptions in the relevant web page. However, if you select a local file from anywhere in the project and have a step to install, the test step will be blocked in this section and you will not be able to select the file from the local and select it in the test step. For t…

---

<div class="post-metadata">

**Author:** ![hinpham](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hinpham](https://forum.katalon.com/u/hinpham)\
**Post date:** [October 1, 2019, 7:43pm UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/4 "2019-10-01T19:43:11Z")

</div>

Hi @devalex88  
Look like type is “div”, here is the completed element:

```auto
<div class="mdl-card__title mdl-card--expand" onclick="showFilePopup('desktop')" ondragend="onOtherDragEvents(event,'desktop')" ondragenter="onOtherDragEvents(event,'desktop')" ondragleave="onImageDragLeft(event,'desktop')" ondragover="onImageDragOver(event,'desktop')" ondragstart="onOtherDragEvents(event,'desktop')" ondrop="onImageDrop(event,'desktop')" style="cursor: pointer;">
    <i class="material-icons mdl-color-text--green-200" style="font-size: 100px; text-align: center; margin-left: auto; margin-right: auto;">insert_photo</i>
</div>

```

---

<div class="post-metadata">

**Author:** ![hinpham](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hinpham](https://forum.katalon.com/u/hinpham)\
**Post date:** [October 2, 2019, 12:09am UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/5 "2019-10-02T00:09:50Z")

</div>

hi @ [emine](http://forum.katalon.com/u/emine), thank much for your tip!  
I followed your steps to create my own customer keywork hpPK.hpKW.uploadFile. it does get called in the script, and does the “WebUI.click(to)” to bring up the file brower, but nothing else happens there…

On Log Viewer, it shows:  
_10-01-2019 04:49:35 PM hpPK.hpKW.uploadFile(findTestObject(“Configuration/Client/div\_insert\_photo”), “/Users[myhome]/bam2/desktop.png”)_  
_Elapsed time: 4.069s_  
_hpPK.hpKW.uploadFile is PASSED_

But on Console log, seeing a bundle of warnings and errors like:  
_2019-10-01 17:05:02.209 INFO c.k.k.core.webui.driver.DriverFactory - Starting ‘Chrome’ driver_  
_Oct 01, 2019 5:05:02 PM org.openqa.selenium.remote.DesiredCapabilities chrome_  
_INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`_  
_2019-10-01 17:05:02.234 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 seconds_  
_Starting ChromeDriver 76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864}) on port 7992_  
_Only local connections are allowed._  
_Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code._  
_[1569974704.022][WARNING]: This version of ChromeDriver has not been tested with Chrome version 77._  
_Oct 01, 2019 5:05:04 PM org.openqa.selenium.remote.ProtocolHandshake createSession_  
_INFO: Detected dialect: W3C_  
_2019-10-01 17:05:04.211 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = a99d0a4e4927b67b95b5386dc96ba416_  
_…_

_2019-10-01 16:49:35.943 DEBUG M-104 Client Configuration - Upload Logo - 6: hpPK.hpKW.uploadFile(findTestObject(“Configuration/Client/div\_insert\_photo”), “/Users/[myhome]/bam2/desktop.png”)_  
_2019-10-01 16:49:39.992 java[58271:1379835] pid(58271)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!_  
_2019-10-01 16:49:39.992 java[58271:1379835] pid(58271)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!_  
_2019-10-01 16:49:39.992 java[58271:1379835] pid(58271)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!_  
_2019-10-01 16:49:40.011 INFO k.k.c.m.CustomKeywordDelegatingMetaClass - hpPK.hpKW.uploadFile is PASSED_  
_2019-10-01 16:49:40.012 DEBUG M-104 Client Configuration - Upload Logo - 7: Thread.sleep(3000)_  
_…_

Any idea what i’m missing? thanks

---

<div class="post-metadata">

**Author:** ![emine](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/emine/32/15639_2.png) [@emine](https://forum.katalon.com/u/emine)\
**Post date:** [October 2, 2019, 6:31am UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/6 "2019-10-02T06:31:18Z")

</div>

> [@hinpham](#):
>
> “Configuration/Client/div\_insert\_photo”), “/Users[myhome]/bam2/desktop.png”)

Hello Again @hinpham  
For parameters (Configuration/Client/div\_insert\_photo”), “/Users[myhome]/bam2/desktop.png”) , the first parameter, Configuration/Client/div\_insert\_photo” ,must be the area you click on.  
When defining the file path in the second parameter, /Users[myhome]/bam2/desktop.png, please define using not only \ \ eg. C: \\users \\ file \\ test.png

---

<div class="post-metadata">

**Author:** ![hinpham](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hinpham](https://forum.katalon.com/u/hinpham)\
**Post date:** [October 2, 2019, 5:58pm UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/7 "2019-10-02T17:58:40Z")

</div>

hi @emine, thanks for quick response.  
When calling my custom keyword hpPK.hpKW.uploadFile(findTestObject(“Configuration/Client/div\_insert\_photo”), “/Users/pham/bam2/desktop.png”)  
I do see the the area has been clicked on by the code “WebUI.click(to)” inside the custom keyword public class (to bring the file brower up just like I manually click on the area), so the first parameter seems correct.  
For the second parameter: my script is running on mac OS X, “/Users/pham/bam2/desktop.png” is a valid path, so i have tried /Users/pham/bam2/desktop.png or //Users//pham//bam2//desktop.png but nothing works.

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:39am UTC](https://forum.katalon.com/t/webui-uploadfile-failed/33969/8 "2022-08-08T07:39:41Z")

</div>


