Closed DipakTated closed 8 hours ago
the script doesn't compile for me - do you mind sharing a minimal csharp project which surfaces this issue? Ideally a small git repository.
the script doesn't compile for me - do you mind sharing a minimal csharp project which surfaces this issue? Ideally a small git repository.
here is a sample csharp project. ConsoleApp1.zip
I was not able to reproduce, I tried on Windows 11, maybe this makes a difference:
Also I installed the browsers via
pwsh .\ConsoleApp1\bin\Debug\playwright.ps1 instal
Probably it doesn't help but I would try updating to latest Playwright - its usually a good practise.
as mentioned, this issue doesnot occur always but once in 20+ trials only. there seems to be problem at playwright transport layer according to me as mentioned in log files:
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Playwright.Transport.Connection.
I see Page crashed
which means the page is crashing. I recommend to set DEBUG=pw:browser
env var which might give us more hints whats going on. Updating Playwright means using a newer Chromium which might has it fixed.
When is newer version v1.49.0 of Playwright going to launch, so we can start using from that?
~ 1 week - I recommend 1.48 so far.
Version
1.40.0
Steps to reproduce
This is the code written in C#
using var playwright = await Playwright.CreateAsync().ConfigureAwait(false);
_logger.Information("Playwright starting to launch chromium"); // Open a new instance of the Google Chrome browser in headless mode await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions { Headless = true }).ConfigureAwait(false); _logger.Information("Playwright launched chromium"); const int SM_CXSCREEN = 0; const int SM_CYSCREEN = 1;
// Get the screen resolution int screenWidth = GetSystemMetrics(SM_CXSCREEN); int screenHeight = GetSystemMetrics(SM_CYSCREEN); // Create a new page in the browser var page = await browser.NewPageAsync(new BrowserNewPageOptions { ViewportSize = new ViewportSize { Width = screenWidth, Height = screenHeight }, }).ConfigureAwait(false);
await page.SetContentAsync(result).ConfigureAwait(false);
Expected behavior
It should run without errors and load the html content
Actual behavior
while running this code, it throws this error sometimes and it happens once in 20 runs:
Additional context
No response
Environment