I have created some tests using Playwright with .NET bindings.
[OneTimeSetUp]
public async Task OneTimeSetUp()
{
random = new Random();
var playwright = await Playwright.CreateAsync();
browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
Headless = false
});
context = await browser.NewContextAsync();
page = await context.NewPageAsync();
}
Before running tests I had run
npx playwright install
before running tests. The outcome of aforementioned command are browsers installed in path C:\Users\username\AppData\Local\ms-playwright
When running tests however, error is thrown:
OneTimeSetUp: Microsoft.Playwright.PlaywrightException : Executable doesn't exist at C:\Users\11033414\AppData\Local\ms-playwright\chromium-907428\chrome-win\chrome.exe
so it seems like playwright wants to use other versions of browsers than installed ones. How to make Playwright point to correct versions of browsers installed?
CodePudding user response:
# Install the CLI once.
dotnet tool install --global Microsoft.Playwright.CLI
# Install the browsers
playwright install
(The current error description is a bug in 1.14, it gets fixed with 1.15.)
CodePudding user response:
According to: https://github.com/microsoft/playwright-dotnet/issues/1638#issuecomment-887340857
the workaround is to use dotnet .\bin\Debug\net5.0\Microsoft.Playwright.dll -- install
I've tried this one and it works for me.