Upload Image on Instagram

Hi Katalon Team! Does anyone have tried the upload image on Instagram using the web? I used sendkeys for upload of an image, and I got an error below.

Instagram modal for upload image:

Note: I tried to click the 'Select from computer" first then I’ll send (using sendkeys) the path of the image file, but I still encounter an error. Is there another way how can successfully upload the image? Thank you!

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

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

At object: 'Object Repository/Home Page_Instagram/Select from computer'

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

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

10-31-2021 01:12:25 PM Test Cases/Instagram

Elapsed time: 42.642s

Test Cases/Instagram FAILED.

Reason:

com.kms.katalon.core.exception.StepFailedException: Unable to send keys '/Users/ryanp.escal/Downloads/katalonss.jpg' to object 'Object Repository/Home Page_Instagram/Select from computer'

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.SendKeysKeyword.sendKeys(SendKeysKeyword.groovy:60)

at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword.execute(SendKeysKeyword.groovy:38)

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

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.sendKeys(WebUiBuiltInKeywords.groovy:864)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$sendKeys$3.call(Unknown Source)

at Instagram.run(Instagram:38)

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

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

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

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

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

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

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

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

at TempTestCase1635657127535.run(TempTestCase1635657127535.groovy:25)

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

(Session info: chrome=95.0.4638.69)

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

System info: host: 'Ryans-MacBook-Pro.local', ip: '2404:3c00:40bf:d320:0:0:0:4%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_275'

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

Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 95.0.4638.69, chrome: {chromedriverVersion: 94.0.4606.61 (418b78f5838ed..., userDataDir: /var/folders/5m/dtcm1fqx701...}, goog:chromeOptions: {debuggerAddress: localhost:61082}, 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:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}

Session ID: 9b1bc264bf49371449bbfa26a4ee7e0d

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.$Proxy11.sendKeys(Unknown Source)

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

at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword$_sendKeys_closure1.doCall(SendKeysKeyword.groovy:53)

at com.kms.katalon.core.webui.keyword.builtin.SendKeysKeyword$_sendKeys_closure1.call(SendKeysKeyword.groovy)

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

... 17 more

You may wanna try Upload File by Drag-and-Drop keyword.

Hi Thanto, Thanks! There is no error already, but I got the file is not supported even though I am uploading a jpg file.

Note: I tried manually uploading the JPG file, and I successfully upload the image. Thank you!

My Code:

            WebUI.click(findTestObject('Home Page_Instagram/Click_Upload'))

            def filePath = RunConfiguration.getProjectDir() + '/pablo.jpg'

            WebUI.uploadFileWithDragAndDrop(findTestObject('Home Page_Instagram/Select from computer'), '/Users/ryanpl/Documents')

You need to pass the variable filePath instead of /Users/ryanpl/Documents into the keyword.

Thanks, Thanto! But I have a question, do I need to locate my image file to the getProjectDir? Because After I run, I got this error below.

My file is located on this path. Thank you!

def filePath = RunConfiguration.getProjectDir() + '/Users/ryanp.escal/Documents/pablog.jpg'

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

Caused by: org.openqa.selenium.InvalidArgumentException: invalid argument: File not found : /Users/ryanp.escal/Katalon Studio/Ryan Cafe24 exam/Users/ryanp.escal/Documents/pablog.jpg

Hi Thanto! I have fixed my issue, I relocated my image file to the project directory. Thank you so much!!

1 Like

I’m sorry to tell you this, @ryan, but you have not solved the problem. You have altered your input to accommodate your bug.

Let me say that a different way by asking you this question: will your users (who you are meant to be emulating) have a Katalon project folder?

The browser supports users uploading files from any path available to them. Your test should cover that.