Skip to content

The header part is missing in the screenshot #108

@Harikavarma35

Description

@Harikavarma35

I have used the below snippet to take the full screenshot of https://www.dell.com/ko-kr website. However, the header part of the Dell website is missing in the screenshot. So when we run the below code, .shootpage with the Capture.Full property, the following happens with the web page:-

  • Initially the page scrolls to the very bottom, step by step in the given intervals of betweenScrollTimeOut.
  • Later the page scrolls nearly to the beginning of the page but not to the very beginning.
  • The screenshot is captured from the current position.

As a result, some part of the page at the very beginning is not captured in the screenshot.

package org.example;
import com.assertthat.selenium_shutterbug.core.Capture;
import com.assertthat.selenium_shutterbug.core.Shutterbug;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
public class HighlightPage {

    public static void main(String[] args) throws Exception {
        ChromeOptions options = new ChromeOptions();
        ChromeDriver driver = new ChromeDriver(options);
        options.addArguments("--force-device-scale-factor=1");
        options.addArguments("--remote-allow-origins=*");
        
        driver.get("https://www.dell.com/ko-kr");
        driver.manage().window().maximize();
        Thread.sleep(12000);
        BufferedImage image = Shutterbug.shootPage(driver, Capture.FULL, 5000).getImage();
        String destFile = org.apache.commons.lang3.StringUtils.joinWith(File.separator,
                    System.getProperty("user.home"), "images", "subfolder", "source.png");
            ImageIO.write(image, "PNG", new File(destFile));
    }
}

ActualPage
actualPage
ShutterBug Screenshot
shutterBug_screenshot1

As you can see that the header with the Dell Technologies, Search box and Languages list are missing in the actual screenshot.

This is happening for most of the sites which have a sticky header, section or div tag.

Need a fix for this issue. Kindly resolve. Thanks in anticipation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions