SHARE
TWEET

Untitled

a guest Jun 18th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ByteArrayInputStream imgbytes = new ByteArrayInputStream(((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES));
  2. assert imgbytes.available() > 0;
  3. BufferedImage bimg = ImageIO.read(imgbytes);
  4. bimg = bimg.getSubimage(0, 0, 500, 500);
  5. assert bimg.getHeight() > 0;
  6. assert bimg.getWidth() > 0;
  7. File imgfile = new File("screenshot.png");
  8. ImageIO.write(bimg, "png", imgfile);
  9. assert imgfile.length() > 0;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top