Answered

Error with Verify_Text_In_PDF

Scenario/Steps:
- Used a Get_Rest_Value command to make a REST call that returns a PDF Byte Array.
- Saved that PDF Byte Array into a var called @ngvb2PdfByteArray
- Used Goto_URL command to open the PDF in Chrome by entering the following value in the URL:
data:application/pdf;base64,@ngbv2PdfByteArray
- PDF is opened in browser
- Used Verify_Text_In_Pdf to verify a text value of 'FA8T' but receive an error from Subject7:

"Error during url parsing: unknown protocol: data"

 

0
4 comments
Avatar
Joseph Hamdan

Hi Dominic,
Instead of
'Goto_URL command to open the PDF in Chrome by entering the following value in the URL: data:application/pdf;base64,@ngbv2PdfByteArray'
You can use a step with Execute_Javascript command with the below:
var link = document.createElement("a");
link.download = 'file_name';
link.href = 'data:application/pdf;base64,@ngvb2PdfByteArray';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
delete link;
So this Javascript step will download your pdf file to local environment
Then, you can use Goto_url and open the next url: file://path_to_the_file
It's better to generate file name on the fly using Set_Var random step, the download path can be specified in the browser options
Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

Thanks, I will try this.

If i use Set_Var to set a random file_name, how do I pass that Var into the Execute_Javascript command?

0
Comment actions Permalink
Avatar
Dominic Luminello

I figured out how to pass the var in but it doesn't seem to work with the script you provided.

See screenshots below.

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Dominic,

Creating a support ticket to investigate this. We will be requesting some more information on the ticket.

Regards,

Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.