autopilot-github

How can we help?

fluent-robot
 

Automation Cloud

Inputting file into <input type = "file" /> field

Hi everyone,

I am having a tough time with automating the file input with Autopilot. In my case, I am using a pdf file converted into a base64 string as an input. As Autopilot suggested, I tried to create a blob object from the input string.

Selection_220

Unfortunately, I couldn’t manage to do it.

I wanted to ask if there is a way to automate this kind of process?

I would appreciate and be grateful for every effort put in this matter and any provided answer.

Thank you very much.

P.S. It would be nice if you could provide me some example how this functionality could be used.

Hello Miroslav!

Glad you reached out to us and sorry for the long response time!
In latest Autopilot version, you can use the following steps to input a file:
Fetch (action) - to download the file for automation to use it, should point to the URL to download the file from an input that looks something like this:

nameOfInput: {
        "url": "https://git-scm.com/images/progit2.png"
        filename: 'progit2.png',
        headers: [
          {
            Someheader: 'valueHeader',
          },
        ],
      }

and the fetch action should be configured to look like this:

This fetch action will create a scope with the blob and allow the inputFile action within to access it.
image

The inputFile action will then just need a query on the input (from the page where the upload works on) and a set-path pipe with fileName, like so:
image

Hope this helps! If not, let us know and we can go into further details.
Cheers,
Alex

Hello Alex,

Thank you on your quick response.
Sorry, for not answering immediately.
I wish to thank you on this resolution and I will try it and write you back.

So, as I can see there is no need for base64 encoded files, right?

Wish you all the best,
Miroslav

Hey!
That is correct! It just needs to be able to download the file to be able to upload it to website mainly.
This will probably improve in the future, as we are iterating over features to make them easier to use, so we appreciate the patience and perseverance needed with this :sweat_smile:

1 Like

Hi Alex!

I am facing some problems with setting the path to the uploaded pdf file. I have uploaded it to the docdroid and got this link https://docdro.id/n1V8p72

Can I ask you make a few screen shots where and how can I set url pointing to the uploaded pdf from my local.

Thank you very much.

Cheers

Here is the screen shot where I am stuck.
I think that I didn’t understand the way of setting every step.
Sorry If I am interrupting you and I hope that you will find time to help me with this matter.

The fetch action needs some params, the url as a minimum. You need to bring the url to the insurance document in scope. Also, if it’s a binary file, make sure that the “response body format” dropdown is set to “blob”.
Once the document is downloaded, this (fetch) action’s scope contains a path to your file, but also its contents.

Hi Mihai,

Thanks for the response.
So let me get this straight, since I am now trying to upload a file that is already uploaded on somewhere like i.e. https://www.docdroid.net/

  1. I need to have a url link to that file inside an input data section.

  2. I need to set fetch action with that input

  3. Inside a fetch action I need to specify an inputFile action which gets the scope of fetch action, and which points to the input element on the page where the file should be uploaded

Is this correct?
(Sorry, I’m new to this and I am trying to understand most of the functionalities that are essential for my work)

Many thanks and all the best to you,
Miroslav

That’s pretty much right. I’ve created a sample script for you, load it in a new profile and check it out, it basically downloads a pdf from somewhere and uploads it elsewhere.

Beware of captcha, you’ll need to complete it yourself.

Here’s the link, just save the .automation file and load it in a different Autopilot profile: file-download-in-memory-upload.json · GitHub

Hi Mihai,

Thanks for helping me with my problem.
I will try to write this part.

Unfortunately I am getting this message when I try to execute your script. I was trying to install the required package but I failed.

Sorry again for bothering you.

Many thanks

Ah, you need to be signed in to install extensions.

You don’t necessarily need to install the extension, just replace the pipes which don’t work, probably filterContainsText with filter -> contains text.

It works!
Many thanks.
I understand now how to use these actions.

I was wondering if there is a way to do an upload of a file that is base64 encrypted? Is there even a way to do this with autopilot? I would like to learn more complex process’ and also to use other API calls for calling my script that I am working with right now.

Thank you very much :smiley: