Skip to main content

I have a process which is generating a dynamic javascript file that I am then passing to Chrome using the Browser: Run JavaScript action and importing that file.

This is working for many instances. However, when the generated file exceeds a certain size, the action fails. I’m unsure on the size limit, but 1.8MB does not work.

I am converting PDF files to an uint8 byte array so I can use a Blob and File API within my dynamic javascript file to upload the file to a webpage.

I can paste this javascript command into my Chrome dev tools and run it without any issues also.

 

Does anyone have any ideas on this?

HI @sleemand! Let me tag a few folks I think may be able to assist you.

@Marc 1985 

@Vatsy 

@Pradeep Kintali 


Thanks for the tag, ​@Lu.Hunnicutt, but I am not sure about the solution for this problem.


@sleemand Although not documented at the moment, it appears the limit is 1MB. I created a JavaScript file with 1.8MB of comments and a single action. It continued to fail as I dropped the file size 100kB at a time until it worked… just below 1MB.

This is likely a limitation of the connector used between Automation Anywhere and Chrome.


@Aaron.Gleason Thanks for checking as well.

I had my suspicious this was the case since I tried pasting the file contents into a manual input javascript action and that failed to launch the bot to begin with.

 

Very unfortunate answer and it seems I’ll need to figure out a different way to handle this.

Automating the browser clicks is not very reliable once a Windows file selection dialog appears.


Yeah, the “manual input” seems to have a limit of approximately 32kB. I’ve let our documentation people know and they should be adding this to the docs page on “Run JavaScript” shortly.

Have you considered writing your JavaScript to open an external file with the uint8 blob contained rather than having the blob integrated into the JavaScript code?

We can also upload files using the REST web service action now starting with our release .35 if that will fit the bill.

Windows file dialogs are odd. I always recommend putting the full path and filename in the “Filename” text box to avoid having to automate the controls on the pop-up (other than the Open button).


I had been using the full filename/path in the popup, but it has caused issues in the process so I was looking for alternatives.

I’ve tried a few things to adjust my JS function to reference a local file instead, but I’ve been running into CORS and CPS errors so far.

I may have just figured this out though. It may be convoluted and over engineered though.

  1. Convert the PDF file to a uint8 array string and save it to a file
  2. start up a flask server through python to serve the uint8 text file
  3. create a javascript file that fetches the content of the uint8 file and triggers the Flie API datatransfer using this content in the Uint8Array constructor.

So far I’ve gotten this working in testing without CORS and CPS errors.

If this is over-engineered I’d love to know where I can trim the fat.


Reply