Closed CyrilIDsoft closed 1 year ago
Whats the error which you are getting?
No definition for CreateAsync in IPlaywright.
Did you add a using for using Microsoft.Playwright;
?
Yes I did.
using System.Threading.Tasks; using Microsoft.Playwright; using Microsoft.Playwright.MSTest; using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CRMImmo.Tests.Playwright { [TestClass] public class UnitTest5 : PageTest { [TestMethod] public async Task MyTest() { using var playwright = await Playwright.CreateAsync(); var firefox = playwright.Firefox; var browser = await firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false }); var page = await browser.NewPageAsync(); await page.GotoAsync("https://www.bing.com"); await browser.CloseAsync(); } } }
I tried in Visual Studio Code and it works ... What's the matter ? ClassLibrary and Net7.0 in both.
Super weird! Maybe the dependencies were not restored in VS. Have you tried following the official intro? https://playwright.dev/dotnet/docs/intro
Might also be a .NET 7 issue, since I've never tested in it, but since it works in VSCode for you, that seems not very reasonable.
Well in VS2022 I used the NuGet package manager to install Microsoft.Playwright.MSTest. I also desinstall and reinstall this package to test, without improvment.
This is most likely an issue on your machine, with the way VS is installed etc. since you are the first person reporting it. Since we are unfortunately not able to reproduce it, we have to close it for now as part of the triaging process. Feel free to put research / investigation notes down below to help further users.
I'd recommend to re-install VS 2022.
I see the same issue , Playwright does not even show up in the list of extensions that Visual Studio 2022 offers for the IDE
I see the same issue , Playwright does not even show up in the list of extensions that Visual Studio 2022 offers for the IDE
This is expected, there is no Visual Studio Playwright extension, only for Visual Studio Code and Node.js: https://playwright.dev/docs/getting-started-vscode
I know this post is an old and closed but I just had this issue. Found out it was because Playwright was referencing PlaywrightTest and not Microsoft.Playwright.Playwright
Hello Playwright noob so be kind. 🙂
I installed Microsoft.Playwright 1.30.0 + Microsoft.Playwright.MSTest 1.30.0 + Microsoft.Playwright.TestAdapter 1.30.0 in my Visual Studio 2022. Trying to run samples found (https://playwright.dev/) I have a compiling error on this sentence :
using var playwright = await Playwright.CreateAsync();
Any idea on what I may have missed ?
Thanks.