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

[Bug]: Screenshot does not capture scrollbar #30228

Open
jpEngProd opened this issue Apr 3, 2024 · 2 comments
Open

[Bug]: Screenshot does not capture scrollbar #30228

jpEngProd opened this issue Apr 3, 2024 · 2 comments

Comments

@jpEngProd
Copy link

Version

1.42.0

Steps to reproduce

  1. Create a .net project with Playwright.Microsoft nuget package.
  2. Add below code in Program.cs
using Microsoft.Playwright;

var browserLaucnhOptions = new BrowserTypeLaunchOptions
{
    Headless = false,
    Timeout = 60000
};

var playwright = await Playwright.CreateAsync();

var browser = await playwright.Chromium.LaunchAsync(browserLaucnhOptions);

var page = await browser.NewPageAsync();
await page.GotoAsync("https://www.bing.com/search?q=scrollbar+in+a+page");
await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot.png", FullPage = true });
await browser.CloseAsync();``

Expected behavior

Screenshot with scrollbar.
image

Actual behavior

Below is the captured screenshot. It does not contain scrollbar.

screenshot

Additional context

Also tried configuring --hide-scrollbars as mentioned in few threads. That also doesnb

var browserLaucnhOptions = new BrowserTypeLaunchOptions
{
    IgnoreDefaultArgs = new List<string>() { "--hide-scrollbars" },
    Headless = false,
    Timeout = 60000
};

Environment

OS: Windows
Playwright version: 1.42.0
Dotnet version: 8.0
Browser: Chrome
@dgozman
Copy link
Contributor

dgozman commented Apr 3, 2024

@jpEngProd Scrollbars are currently hidden in headless mode. I understand that it is sometimes desirable to see scrollbars in the screenshot, but there is no control over scrollbars in Playwright API yet.

@jpEngProd
Copy link
Author

Even for non-headless mode scrollbars are hidden.
I have added Headless = false in above provided code snippets

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

No branches or pull requests

2 participants