|
From: RBRi <rb...@us...> - 2019-07-11 18:44:07
|
Hi, first of all you are using a really really outdated version of HtmlUnit. If you like to get any support use the latest version. Second: No image response available (src=) looks like there is no src value in the img tag in the page. Maybe some javascript fill the image. If you really like more detailed support you have to add more details to give me a chance to reproduce your case. --- ** [bugs:#2020] Unable to save image locally from HtmlImage object** **Status:** open **Group:** 2.35.0 **Created:** Thu Jul 11, 2019 04:58 AM UTC by raman palikala **Last Updated:** Thu Jul 11, 2019 04:58 AM UTC **Owner:** nobody **Attachments:** - [Image_Content_As_JSON.txt](https://sourceforge.net/p/htmlunit/bugs/2020/attachment/Image_Content_As_JSON.txt) (2.0 kB; text/plain) Hi Team, I have just started exploring HtmlUnit. I am using htmlunit v2.21. The problem is I am unable to save image from HtmlImage object. Below is my sample code : HtmlImage image = (HtmlImage) page .getByXPath("//img[@id='captchaDetailImg' and @class='bordered-desktop']") .get(0); File captchaFile = new File(newFilePathOfImage); image.saveAs(captchaFile); Here, in the above code when **image.saveAs(captchaFile);** is executed it is throwing the following error: **java.io.IOException: No image response available (src=)** When I observed the same html page in the browser to identify the cause of the error, I noticed that it is due to the image in the page not being transferred as a file, but the image did come as a response of type application/json. And that json content is of binary and I am not able to see the properties and their values in the json content. Please find the attached which has the response in json for the image. Could you please let me know what I have to do to construct the image from the json content OR is there any way to get the image directly or save it locally from the HtmlImage object in this scenario? Awaiting for your response. Thanks and regards, Raman Palikala. --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |