puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

Unable to capture the full screenshot in desktop view for the website https://www.amazon.jobs/ by using PuppeteerSharp

Open ShahinaShanu opened this issue 2 years ago • 3 comments

We are using the below source code to capture the full screenshot in desktop view, but the footer is missing, Also you can see the output screenshot.

Source Code: using var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(BrowserFetcher.DefaultChromiumRevision); var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true, DefaultViewport = new ViewPortOptions { Width = 1900, Height = 2000 } }); var page = await browser.NewPageAsync(); await page.GoToAsync(siteUrl, new NavigationOptions { Timeout = 100000 }); await page.EvaluateExpressionAsync("window.scrollTo(0, document.body.scrollHeight)"); await page.WaitForTimeoutAsync(4000); await page.EvaluateExpressionAsync("window.scrollTo(0, 0)"); await page.WaitForTimeoutAsync(2000); await page.ScreenshotAsync(imageSavePath, new ScreenshotOptions { FullPage = true });

imageSavePath-2

ShahinaShanu avatar Jun 22 '23 18:06 ShahinaShanu

Please reply as soon as...kindly help us to sort this issue.

ShahinaShanu avatar Jun 23 '23 09:06 ShahinaShanu

Did you try with Headless in false?

kblok avatar Jun 23 '23 15:06 kblok

Thanks for the reply. Yes, I have checked with the Headless = false and removed the default DefaultViewport option also but the result is the same. Also, we are facing an issue while capturing the site (https://eatfoodwithpurpose.com/). below is the attached screenshot of both mobile and desktop view (incomplete captured screenshots). Please suggest something to resolve this issue.

var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false
}); var page = await browser.NewPageAsync(); using var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(BrowserFetcher.DefaultChromiumRevision); await page.GoToAsync("https://www.amazon.jobs/", new NavigationOptions { Timeout = 100000 }); await page.EvaluateExpressionAsync("window.scrollTo(0, document.body.scrollHeight)"); await page.WaitForTimeoutAsync(4000); await page.EvaluateExpressionAsync("window.scrollTo(0, 0)"); await page.WaitForTimeoutAsync(2000); await page.ScreenshotAsync(""CapturedImage.png"", new ScreenshotOptions { FullPage = true });

[Ist Screenshot: https://www.amazon.jobs/] image

[2nd Screenshot : https://eatfoodwithpurpose.com/] (Mobile View) image

(Desktop View) image

ShahinaShanu avatar Jun 26 '23 07:06 ShahinaShanu