When using Playwright version to 1.41.1 or later.
page.PdfAsync() method throw following exception.
NullReferenceException: Object reference not set to an instance of an object.
at async Task<byte[[]]> PdfAsync(PagePdfOptions options) in Page.cs:874
Context:
GOOD Playwright Version: 1.41.0
BAD Playwright Version: 1.41.1
Operating System: [Windows, Linux or Mac]
Code Snippet
await await page.PdfAsync(); // It's works on `1.41.0` but not works on `1.41.1`
await await page.PdfAsync(new PagePdfOptions {}); // It works on both version.
When using Playwright version to
1.41.1
or later.page.PdfAsync()
method throw following exception.Context:
1.41.0
1.41.1
Code Snippet
Describe the bug It seems null checks are missing on latest changes. https://github.com/microsoft/playwright-dotnet/blob/main/src/Playwright/Core/Page.cs#L867-L876
I though this problem can be resolved by adding following line. (It's used on
ScreenshotAsync
method)