File Upload Mac without input field

I try to upload an image to a site. The site looks like this:

There is no input field in the code, only divs:

I created a test object with xpath //div[@class=“fileuploader-input”] and tried the following:
def filePath = ‘/Users/username/Downloads/image.jpg’
WebUI.uploadFile(findTestObject(‘Object Repository/Pages/CreateAd/imageUploader’), filePath, FailureHandling.CONTINUE_ON_FAILURE)

I get the error message:
2020-09-24 09:07:35.325 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to upload file ‘/Users/nilsjansen/Downloads/BMW.jpg’ to object ‘Object Repository/Pages/CreateAd/imageUploader’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to upload file ‘/Users/nilsjansen/Downloads/BMW.jpg’ to object ‘Object Repository/Pages/CreateAd/imageUploader’
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:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.uploadFile(WebUiBuiltInKeywords.groovy:2957)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$uploadFile$9.call(Unknown Source)
at NewAd-foo-bar.run(NewAd-foo-bar:25)
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:339)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:191)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:141)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:90)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1600931221357.run(TempTestSuite1600931221357.groovy:39)
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable
(Session info: chrome=85.0.4183.121)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘nilsjansen.local’, ip: ‘fe80:0:0:0:85d:419b:e709:413b%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.15.6’, java.version: ‘1.8.0_181’

Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 85.0.4183.121, chrome: {chromedriverVersion: 85.0.4183.87 (cd6713ebf92fa…, userDataDir: /var/folders/gl/sks0f7j17hn…}, goog:chromeOptions: {debuggerAddress: localhost:59141}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}

Session ID: 2d557ba812c368331944f9b79f3e549e
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 org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.lambda$new$0(EventFiringWebDriver.java:404)
at com.sun.proxy.$Proxy13.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:20)
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:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.uploadFile(WebUiBuiltInKeywords.groovy:2957)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$uploadFile$9.call(Unknown Source)
at Script1600261913273.run(Script1600261913273.groovy:25)
… 13 more
)

I don’t get it, can someone help me?

1 Like

try xpath //input[@type=“file”]
pointing to the input right above the div you are currently trying to use, it seems to be the one to handle what you do in that div

1 Like

Sometimes you oversee the easy things. Thank you, but I am not yet finished. It seems to work now and I get the message
File ‘/Users/username/Downloads/image.jpg’ sent to object: ‘/Pages/imageUploader’

but the upload does not work. What can be the issue now?

i haven’t used inputs that often myself, and considering the keyword does in fact state that it succesfully uploaded the file, maybe more user actions are needed to confirm the upload before the view will change? your best bet(unless someone else has a better answer) is to manually do the upload and see if anything changes in the page at the different steps

1 Like

Actually it is just drag and drop…

Tried it again and it wooooooorks. Thank you, @kenzie.rigole!!!