Home > Enterprise >  Cannot install playwright: Couldn't find project using Playwright. Ensure a project or a soluti
Cannot install playwright: Couldn't find project using Playwright. Ensure a project or a soluti

Time:11-15

I'm trying to install playwright on my deployment target machine in order to run UI tests.

# Install the CLI once.
dotnet tool install --global Microsoft.Playwright.CLI

playwright install

however when using the playwright CLI including playwright install I get:

Couldn't find project using Playwright. Ensure a project or a solution exists in C:\users\myuser, or provide another path using -p.

How do I install playwright on a vm?

CodePudding user response:

You need to execute playwright install in the folder that contains the csproj or use -p to specify the project file

# Create project
dotnet new console -n PlaywrightDemo
cd PlaywrightDemo

# Install dependencies, build project and download necessary browsers.
dotnet add package Microsoft.Playwright
dotnet build
playwright install

See the documentation for more details: https://playwright.dev/dotnet/docs/intro#first-project

You can also install the browser from the code using:

using Microsoft.Playwright;

var exitCode = Microsoft.Playwright.Program.Main(new[] { "install" });
  • Related