microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.76k stars 3.66k forks source link

Looks like Playwright was just installed or updated. ║ ║ Please run the following command to download new browsers:[BUG] #17930

Closed SmNizamani closed 2 years ago

SmNizamani commented 2 years ago

I am getting this error while running my first playwright test in Visual studio. Here is the full message in test detail summary:  Test1  Source: UnitTest1.cs line 13  Duration: 817 ms

Message:  Microsoft.Playwright.PlaywrightException : Executable doesn't exist at C:\Users\Nizamani\AppData\Local\ms-playwright\chromium-1024\chrome-win\chrome.exe ╔════════════════════════════════════════════════════════════╗ ║ Looks like Playwright was just installed or updated. ║ ║ Please run the following command to download new browsers: ║ ║ ║ ║ pwsh bin/Debug/netX/playwright.ps1 install ║ ║ ║ ║ <3 Playwright Team ║ ╚════════════════════════════════════════════════════════════╝

Stack Trace:  Connection.InnerSendMessageToServerAsync[T](String guid, String method, Object args) line 163 Connection.WrapApiCallAsync[T](Func1 action, Boolean isInternal) BrowserType.LaunchAsync(BrowserTypeLaunchOptions options) line 61 Tests.Test1() line 18 GenericAdapter1.BlockUntilCompleted() NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter) AsyncToSyncAdapter.Await(Func`1 invoke) TestMethodCommand.RunTestMethod(TestExecutionContext context) TestMethodCommand.Execute(TestExecutionContext context) <>c__DisplayClass1_0.b__0() DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Code Snippet public async Task Test1() { //initialize playwright using var playwright = await Playwright.CreateAsync(); //browser= await using var browser = await playwright.Chromium.LaunchAsync(); //page var page = await browser.NewPageAsync(); await page.GotoAsync(url:"www.google.com"); await page.ClickAsync(selector: "text=Google Search");

mxschmitt commented 2 years ago

You need to open a Terminal, and then execute

pwsh bin/Debug/net6.0/playwright.ps1 install

inside you project's directory.

acampa commented 2 years ago

You need to open a Terminal, and then execute

pwsh bin/Debug/net6.0/playwright.ps1 install

inside you project's directory.

I get this error message when I do:

PS C:\Users....\Desktop\Playwright\PlayWrightDemo> pwsh bin/Debug/net6.0/playwright.ps1 install pwsh : The term 'pwsh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Using visual studio pro if that matters

mxschmitt commented 2 years ago

You need to install PowerShell 7+, see here: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.2

acampa commented 2 years ago

You need to install PowerShell 7+, see here: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.2

Worked for me. Thank you

ZoOoM663 commented 1 year ago

Screenshot (7) Screenshot (8)

can you help me?

EdwinArroyoM commented 1 year ago

PS TestUserGit> pwsh bin/Debug/netX/playwright.ps1 install The argument 'bin/Debug/netX/playwright.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Usage: pwsh[.exe] [-Login] [[-File] [args]] [-Command { - | [-args ] | [] } ] [-ConfigurationName ] [-ConfigurationFile ] [-CustomPipeName ] [-EncodedCommand ] [-ExecutionPolicy ] [-InputFormat {Text | XML}] [-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile] [-NoProfileLoadTime] [-OutputFormat {Text | XML}] [-SettingsFile ] [-SSHServerMode] [-STA] [-Version] [-WindowStyle