Let's say I've requested a page and it's fully loaded. Is it possible to save the images from the rendered/loaded page without sending another request for the image? This would be to avoid just collecting the individual image urls and hammering the server for each image again.
Asked
Active
Viewed 487 times
1 Answers
-1
transfer this to python code.
byte[] slideBg = page.locator("xpath=id(\"slideBgWrap\")").screenshot();
ByteArrayInputStream inStreambj = new ByteArrayInputStream(slideBg);
BufferedImage newImage = ImageIO.read(inStreambj);
ImageIO.write(newImage, "jpg", new File(url + "outputImage.jpg"));

yu li
- 1
-
1Why not just provide Python code, as requested? – Jeremy Caney Aug 20 '23 at 01:00
-
# Capture screenshot and convert to bytes : `slide_bg = page.locator('xpath=id("slideBgWrap")').screenshot()` – yu li Aug 22 '23 at 23:42