Answered

Verify_Text_In_Pdf method doesn't work

Our application requires verification of the text within multiple PDF files. Almost on each page, we have an option to open PDF file and I would like to verify if it includes specific text. So, "Verify_Text_In_Pdf" is very important method which I can't currently use because it always returns some kinda error. If I use it on publicly available application, I get an error: "Cannot parse the PDF reason:Error: End-of-File, expected line". Below is the simple steps.

  1. Navigate to "https://data.hrsa.gov/maps/map-gallery" page
  2. Click on "Health Professional Shortage Areas" Tab
  3. Click on "Health Professional Shortage Areas - Primary Care" link
  4. Verify "Health Professional Shortage Areas (HPSA) - Primary Care" title in PDF file

If I use any lower environment, I get error: "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

Same issue happens with all PDF files all over the website. It used to work just fine and now most of our scripts can't be completed due to this issue with this method.

Is there any issue with this method and are you planning to fix it? At this moment, I stuck with multiple automated test cases which are using this method and are failing.

 

0
6 comments
Avatar
Joseph Hamdan

Hi Vitaly,

Were there any recent changes made to the way PDF files appear? So that they now open in new tab?

The reason for this question is that Verify_Text_In_PDF needs to be supported with "Target Window" field, otherwise it's going to think the value is on the Main page. 

I did some tests using the provided pages above and I was able to use "application/pdf" as Target Window, all of the tests passed. Here is a snapshot of one of them:

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Vitaly Melnik

Thank you Joseph. Your suggestion seems to be working. I've tried multiple textual values from PDF file (e.g. file name "HPSAPC.pdf", or some other unique text values like "Legend" or "HPSA Score") for Target Window and none of them worked. Was getting error message that window with this target value can't be found. Yours seems to be working now. Any suggestions which values would be the best to use in "Target Window" field to identify PDF new window? What is the logic behind the scene for "Target Window" parameter?

Also, any suggestions for the second problem where I get "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target" error message when trying to verify pdf text in lower environments?

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Vitaly,

The "Target Window" value should be something that uniquely identifies the page from another one. During my tests, I used "HPSAPC.pdf" as well as others, but they existed on both pages, so it always tried to search on the main page. 

On the page that displays the PDF file, if you press CTRL+SHIFT+I and go to the inspector, I found that "type" attribute value "application/pdf" to be something found only on the PDF page, so it worked. If you use values found on the URL or the page and they fail, you can always inspect the page to find good examples of keywords to use.

Regarding the error messages, this is a bug and I have submitted a ticket to get this fixed. Thank you for reporting it.

Please let us know if you have any more questions. Have a great day!

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Vitaly Melnik

Hi Joseph,

Would you be able to provide any estimation regarding the fix for this bug? Reason I'm asking is that almost every page in my application has a link which navigates to PDF file and I need to verify if PDF file was opened on the click and has proper title or some other text related to this PDF. So, at this moment I can't run most of my scripts in any lower environment.

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Vitaly,

We will check and provide an update as soon as possible for fixing this issue, but the fix is planned for the message that appears in case of a failure. As far as the command itself, it is working as long as it is supplied with the correct Target Window. Is there any other issue that you are experiencing with the command?

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Vitaly,

Apologies for any confusion. The planned fix that was mentioned is for the error "cannot parse the PDF.." which does not occur if the correct Target Window is specified.

The exception you have posted "sun.security.validator..." is related to a certificate issue. When local player tried to access the PDF document it tries to connect to the site https://data.test.hrsa.gov. It seems that there is something wrong with the certificate on this site or the machine trying to connect to this site is not up to date with certificate. The following posts show the same issue that you encountered:
https://subject7.zendesk.com/hc/en-us/community/posts/360038009373-Using-Execute-Rest-method-on-lower-environments

https://subject7.zendesk.com/hc/en-us/community/posts/360043710254-Unknown-error-displayed-for-File-Upload-steps-after-upgrade-to-8-11-Local-Run-only

Regards,

Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.