Katalon Automation Recorder - How to do a File Upload? HTMLInputElement

Hi,

I’m trying to migrate my Selenium IDE scripts and the file upload command

type | id=fileuploadelement | c:\mypath\logo.jpg

fails with the error:

Failed to set the ‘value’ property on ‘HTMLInputElement’: This input element accepts a filename, which may only be programmatically set to the empty string.

I recorded a file upload manually and it recorded the same command (except it changed my path to ‘c:\fakepath\’

How do I do a file upload in Katalon Automation Recorder?

Thanks,
Trish

It just occurred to me that this might be something that was restricted by Chrome. I have an inkling that Selenium IDE was only ever a Firefox plugin because there were some commands that weren’t permitted by the Chrome API. So I installed Firefox and got the Firefox Katalon plugin and it also failed on the upload with this error:

The operation is insecure.

Hello,

Please, something new about this issue?
I have a same problem…

Thanks in advance.

Hi everyone,

Sorry for letting you wait. We will release a fix for Chrome version next week. Unfortunately, we currently cannot do the same thing for Firefox version due to the browser’s mechanism.

Hi everyone,

New version (3.3.2) has been released. As being said earlier, o****nly Chrome version of the extension is supported, and CSS locator must be used. Make sure the value is a correct absolute file path. Invalid file path might stop the execution.

Screenshot from 2018-03-05 21-22-12.png

Alex said:

Hi everyone,

New version (3.3.2) has been released. As being said earlier, only Chrome version of the extension is supported, and CSS locator must be used. Make sure the value is a correct absolute file path. Invalid file path might stop the execution.

Thanks Alex!

Hi,

I´m trying to upload file with windows but I have a problem.
katalon can not find the file.

C:\\Users\\trabajo\\Downloads\\1516223902.jpg

Any example in windows?

Thank!

Hi,

Escaping “\” in path is unnecessary. Please use “normal path” with just a single “\” instead of “\”.

maria jose said:

I have the same problem.

LOG: [error] {“code”:-32000,“message”:“DOM Error while querying”}

You are using xpath… you should use CSS selector instead! :wink:

Try:

css=input[id="archivo_documento_admisibilidad_1"]

And make sure you’re doing your tests in **Chrome **since it’s not possible in Firefox.

Let me know if that works out for you…

Thanks so much!!! It’s worked :slight_smile:

Hi,

I am happy to see this post and I tried uploading a file. It was successful.

Issue was with after uploading the file.

After adding the attachment I need to click on Upload File - here the file got attached was getting removed again. Can you please help me out on how to fix this.

Other thing, it is showing tests passed - but attachment was missing…

Alex said:

Hi everyone,

New version (3.3.2) has been released. As being said earlier, o****nly Chrome version of the extension is supported, and CSS locator must be used. Make sure the value is a correct absolute file path. Invalid file path might stop the execution.

Will this be fixed in the later versions for firefox browser.

Hi there, I’ve been working on a similar issue and it seems that however I follow the format, the upload just isn’t successful

also, since I was working on the Katalon IDE for firefox, I saved and opened my suite in a new chrome IDE, and this resulted in my “senKeys ${KEY_DOWN}/{KEY_ENTER}” not working anymore. they just don’t change the data entry.

here is a clip of my css=# attempt

Capture.PNG

vilva manggkhai said:

Hi there, I’ve been working on a similar issue and it seems that however I follow the format, the upload just isn’t successful

also, since I was working on the Katalon IDE for firefox, I saved and opened my suite in a new chrome IDE, and this resulted in my “senKeys ${KEY_DOWN}/{KEY_ENTER}” not working anymore. they just don’t change the data entry.

here is a clip of my css=# attempt

Why? #

sendKeys | css=input[id="ASUploadName"] | C:\filelocation?

You can also try to use typeKeys or just Type?

Hi, I tried it with the css=input[] and I tried replacing sendKeys with typeKeys (when I first recorded, the default was Type, and it didn’t work), but it still doesn’t work.

Riyar said:

Will this be fixed in the later versions for firefox browser.

Thank you for the question. We are actively looking for a solution. I’ll keep you posted.

Hi everyone,

I just want to inform that since 3.4.10 the limitation with CSS locators has been lifted. Now you can set file input values in Chrome using all types of locators.

Regarding Firefox version, I would like to ask you a question. Would it help if we add the ability to call external applications (e.g. AutoIT), and you can use them to automate steps that we cannot?

Thank you all for your support :).

1 Like

Hi, sorry but I’m still unclear on the uses of CSS to upload a local file. I’m new to selenium and Katalon so bare with me.
What command, target and (if there’s supposed to be more than one line) sequence do I use upload a file from my local drive onto web-page.

say the web-page’s upload section is like this:

and it opens a upload window like this:

and I want to select one of the pdfs or jpgs.

How do I write the code in here:

Please help ASAP.
Thank you, sorry for my confusion.

upload sample.PNG

Upload window sample.PNG

Katalon AR sample.PNG

@vilva manggkhai

Thank you for the question. Please see FAQ #2 https://docs.katalon.com/x/7gHR for the answer.