Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The header part is missing in the screenshot #108

Open
Harikavarma35 opened this issue May 17, 2023 · 1 comment
Open

The header part is missing in the screenshot #108

Harikavarma35 opened this issue May 17, 2023 · 1 comment

Comments

@Harikavarma35
Copy link

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.

@adarshpurohit
Copy link

@Harikavarma35 Were you able to find a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants