Cannot verify "PDF" spawned web pages

hi,

check my comment here
http://forum.katalon.com/t/katalon-pdf-comparison/19074/4

Thanks Dave for your work on this. It will make validating the many pdf’s we maintain a cinch. One issue I am having is in my Dev environment, we don’t maintain valid certs so I end up with the following error. I have imported the cert into cacert in Katalon. The code does load the pdf but fails when trying to use the ReadPDF code.

Any help on bypassing the SSL issue would be greatly appreciated.

Test Cases/Check PDF FAILED.
Reason:org.codehaus.groovy.runtime.InvokerInvocationException:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:49)

Hi Dennis,

I am not sure how you would solve your SSL issue.

Any Katalon folks have an idea?

Appreciate you responding Dave. I was able to find a work around for my SSL issue. I have added the below to the Check PDF Test Case and the issue is no longer showing.

//######################################
//Remove/Comment out the section below when testing in production!!!

def nullTrustManager = [
checkClientTrusted: { chain, authType -> },
checkServerTrusted: { chain, authType -> },
getAcceptedIssuers: { null }
]

def nullHostnameVerifier = [
verify: { hostname, session ->
//true
hostname.startsWith(‘yuml.me’)
}
]

javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance(“SSL”)
sc.init(null, [nullTrustManager as javax.net.ssl.X509TrustManager] as javax.net.ssl.X509TrustManager[], null)
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory())
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(nullHostnameVerifier as javax.net.ssl.HostnameVerifier)
//Remove/Comment out the section above when testing in production!!!
//######################################

Taken from - https://gist.github.com/barata0/63705c0bcdd1054af2405e90c06f6b71

Hi Dennis,

This is great news!

And thanks for posting your solution; this may help the next person to solve a similar issue.

Best regards,
Dave

This Worked for me also. Thanks !

1 Like

@Pavel1 I have done this but still I am getting the same error

Hi Everyone i am getting End of File, expected Line Error. I am download the Jars through External Libraries in Katalon Studio. I am really new…Please help me…I am attaching the screenshot for the reference.

Hi Everyone

I am getting End of File, expected Line Error. I have downloaded the Jars through External Libraries in Katalon Studio. I am really new…Please help me…I am attaching the screenshot for the reference.

Hi Everyone,

I am trying to read contents from an iFrame page (supposed to be a pdf doc) so that I can verify if the texts inside PDF is having the correct values as expected.

However, I am unable to do so when I used the above method mentioned by Dave to read from PDF. I get “End of File, expected Line Error.”

Is there a way to read from iFrame using Katalon?

java.io.IOException: Server returned HTTP response code: 401 for URL:

Facing the above issue when we try to read the PDF file

Hi Dave,
Thank you for the code to read the PDF from the url .
It works like charm.
But I have different Application where when I click view PDF(No ‘download’ button available so need to click ‘view PDF’ button) PDF opens in the chrome where I need to read the data.
Application with Button to View PDF Button


when I click the button,browser opens the PDF as shown below

For this type of Application code given by you is not working.
Pls guide.