I am trying to validate the contents of a pdf letter for my test automation. For that, first I am trying to download the pdf file to my local machine and validate. But I am not able to download the file properly with Java. The pdf is present as an embedded document in a page which requires me to log in first. The html looks like below
<td colspan="2" style="vertical-align:top;" id="frameCell_24743998"><iframe id="viewFrame_24743998" src="https://wewewe.net/ewr/ww/desk/ViewQCWalzPDFAction.do?recordId=24743998&we=we&partitionId=16515&Id=1561024580039s79n0a" height="550" width="800" style="width: 1254px;"></iframe><br></td>
So I have got the url and tried to download the file using
FileUtils.copyURLToFile(new URL("https://wewewe.net/ewr/ww/desk/ViewQCWalzPDFAction.do?recordId=24743998&we=we&partitionId=16515&Id=1561024580039s79n0a"), new File("C:\\workspace\\dfdf\\dfdffddf\\dd.pdf"));
But it is showing
java.net.ConnectException: Connection timed out: Exception.
So is this because I haven't logged in to the application and trying to download. Is there any other way to download it?