[Sharing is learning] [Get rewards] Join Us Now to Become Katalon Champions. Learn more
Trish McDonough
Katalon Apprentice
01/23/2018

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
Upvote
Quote

Comments

  • Trish McDonough
    Katalon Apprentice
    01/23/2018
    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.

    Upvote
    Quote
  • Fabiola Mero Ramírez
    Katalon Apprentice
    03/01/2018
    Hello, 

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

    Thanks in advance.

    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/03/2018
    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.
    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/05/2018
    edited March 6
    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.


    Upvote
    Quote
  • Patrick Groot
    Katalon Ambassador
    03/05/2018
    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! 
    Upvote
    Quote
  • mlopez
    Katalon Apprentice
    03/05/2018
    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!

    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/06/2018
    Hi,

    Escaping "\" in path is unnecessary. Please use "normal path" with just a single "\" instead of "\\".
    Upvote
    Quote
  • mlopez
    Katalon Apprentice
    03/06/2018
    I have the same problem.

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

    Upvote
    Quote
  • Patrick Groot
    Katalon Ambassador
    03/06/2018
    edited March 6
    I have the same problem.

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

    You are using xpath... you should use CSS selector instead! ;)

    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...
    Upvote
    Quote
  • mlopez
    Katalon Apprentice
    03/06/2018
    Thanks so much!!! It's worked  :)
    Upvote
    Quote
  • deepti
    Katalon Apprentice
    03/09/2018
    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.


    Upvote
    Quote
  • deepti
    Katalon Apprentice
    03/09/2018
    Other thing, it is showing tests passed - but attachment was missing...
    Upvote
    Quote
  • Riyar
    Katalon Apprentice
    03/13/2018
    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.



    Will this be fixed in the later versions for firefox browser.
    Upvote
    Quote
  • vilva manggkhai
    Katalon Apprentice
    03/21/2018
    edited March 21
    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


    Upvote
    Quote
  • Patrick Groot
    Katalon Ambassador
    03/21/2018
    edited March 21
    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?
    Upvote
    Quote
  • vilva manggkhai
    Katalon Apprentice
    03/22/2018
    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.


    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/22/2018
    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.
    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/23/2018
    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 :).
    Upvote
    Quote
  • vilva manggkhai
    Katalon Apprentice
    03/27/2018
    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.
    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/27/2018
    edited March 27
    @"vilva manggkhai"

    Thank you for the question. Please see FAQ #2 https://docs.katalon.com/x/7gHR for the answer.
    Upvote
    Quote
  • Robert van Hall
    Katalon Apprentice
    03/27/2018
    Wow, I was struggling with the upload file for a while. That is: until I discovered this thread today. Thank you very much for this life-saving info, Alex & Patrick!
    Upvote
    Quote
  • vilva manggkhai
    Katalon Apprentice
    03/28/2018
    Yes, I finally got my code to work. thank you so much.
    Upvote
    Quote
  • Jack Benton
    Katalon Apprentice
    03/30/2018
    Hello!
    Can i upload file in Iframe?
    I'm trying to use in Chrome extension:
    selectFrame | css=#frameId |
    type | css=#inputFileId | C:\file

    It doesn't work  :(

    Upvote
    Quote
  • Alex
    Katalon Moderator
    03/30/2018
    edited March 30
    @"Jack Benton",

    Thank you for the bug report. We will investigate the issue. I'll keep you posted.
    Upvote
    Quote
  • Peter Nicolaisen
    Katalon Apprentice
    04/16/2018
    Alex said:
    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 :).
    Hi Alex,

    anything new on this issue?
    Not being able to import files in FF is a huge roadblock for us at the moment.

    Using autoIT, autoHotkey or something similar wouldn't be the most graceful solution, but at least we could go on porting our cases from Selenium to Katalon.

    Thank you!!
    Upvote
    Quote
  • Alex
    Katalon Moderator
    04/17/2018
    Thank you for the feedback. We found a solution and will have a release for it. We know it has been a while and we will try to deliver it as soon as possible.
    Upvote
    Quote
  • Peter Nicolaisen
    Katalon Apprentice
    04/18/2018
    Alex said:
    Thank you for the feedback. We found a solution and will have a release for it. We know it has been a while and we will try to deliver it as soon as possible.
    Awesome!
    Thanks for all the hard work you guys put into this.
    Upvote
    Quote
  • Matthew Miyares
    Katalon Apprentice
    04/30/2018
    Had a similar solution to vilva manggkhai above, only my upload interface looks like this:


    Since it works off of drag and drop, rather than the browse/enter filepath system vilva showed, I can't find any way of using css locators to find what I could target to send the file path to.
    Upvote
    Quote
  • Peter Nicolaisen
    Katalon Apprentice
    05/14/2018
    Any news on a possible release date for the fix/solution? :o :p
    Upvote
    Quote
  • Alex
    Katalon Moderator
    05/17/2018
    edited May 17
    Fixes in version 3.5.6:
    Upvote
    Quote
Sign In or Register to comment.