When using a website and capturing pictures of specific elements on screen, Sometimes we encounter a problem in which the element is not captured in its fullest form. After investigating the issue I understand it happens when the Chrome browser opens on laptop screen, which is smaller and that's why the elements are not shown completely. How can I solve this issue? It also happens on Jenkins sometimes, how is that?
Here is my code snippet:
byte[] imageResult = element.getScreenshotAs(OutputType.BYTES);
BufferedImage imageSnapshot = ImageIO.read(new ByteArrayInputStream(imageResult));