I'm trying to verify if a link is throwing response code
other than 200
. Link, that I'm trying to verify is https://
and after process has run, it throws this error --
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
Code that I'm using --
URL h1 = new URL(crazyLink)
HttpURLConnection huc1 = (HttpURLConnection) h1.openConnection();
huc1.setRequestMethod("GET");
huc1.connect();
if(huc1.getResponseCode() == 200){
System.out.println("Passed");
}else{
System.out.println("Failed");
}
I've tried changing FirefoxProfile
to ignore ssl
, but it didn't work --
firefoxProfile profile=new firefoxProfile();
Profile.setAssumeUntrustedCertificateIssuer(false);
driver=new firefoxDriver(profile);
Any ideas?