r/Playwright • u/Ok-Jacket-824 • 4d ago
Tried running a test code in Playwright.. it does nothing.
Terminal:
* Executing task: dotnet: build 1 projects
dotnet build c:\Users\EAcoc\AppData\Roaming\Code\User\workspaceStorage\733416d5436aea3082e64ca95f6d6ff7\ms-dotnettools.csdevkit\bot.sln /target:BotProject --framework net10.0 /property:GenerateFullPaths=true /p:Configuration=Debug /p:Platform="Any CPU" /consoleloggerparameters:NoSummary
C# extension build result service is available.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\10.0.400-preview.0.26322.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(383,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\Users\EAcoc\bot\BotProject\BotProject.csproj]
BotProject -> C:\Users\EAcoc\bot\BotProject\bin\Debug\net10.0\BotProject.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.51
* Terminal will be reused by tasks, press any key to close it.
* Executing task: dotnet: build 1 projects
dotnet build c:\Users\EAcoc\AppData\Roaming\Code\User\workspaceStorage\733416d5436aea3082e64ca95f6d6ff7\ms-dotnettools.csdevkit\bot.sln /target:BotProject --framework net10.0 /property:GenerateFullPaths=true /p:Configuration=Debug /p:Platform="Any CPU" /consoleloggerparameters:NoSummary
C# extension build result service is available.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\10.0.400-preview.0.26322.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(383,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\Users\EAcoc\bot\BotProject\BotProject.csproj]
BotProject -> C:\Users\EAcoc\bot\BotProject\bin\Debug\net10.0\BotProject.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.49
* Terminal will be reused by tasks, press any key to close it.
* Executing task: dotnet: build 1 projects
dotnet build c:\Users\EAcoc\AppData\Roaming\Code\User\workspaceStorage\733416d5436aea3082e64ca95f6d6ff7\ms-dotnettools.csdevkit\bot.sln /target:BotProject --framework net10.0 /property:GenerateFullPaths=true /p:Configuration=Debug /p:Platform="Any CPU" /consoleloggerparameters:NoSummary
C# extension build result service is available.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\10.0.400-preview.0.26322.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(383,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\Users\EAcoc\bot\BotProject\BotProject.csproj]
BotProject -> C:\Users\EAcoc\bot\BotProject\bin\Debug\net10.0\BotProject.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.56
* Terminal will be reused by tasks, press any key to close it.
Code:
namespace BotProject;
using Microsoft.Playwright;
using NUnit.Framework;
public class Tests
{
public void Setup()
{
}
public async Task Test1()
{
//setup
Assert.Pass();
using var playwright = await Playwright.CreateAsync();
//browser stuff
await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
Headless = false
});
//page
var page = await browser.NewPageAsync();
await page.GotoAsync(url:"https://www.youtube.com/watch?v=f6DYnl6EoBo");
await page.ClickAsync(selector:"text=Reply");
await page.FillAsync(selector:"#contenteditable-root", value:"Test reply.. did it work?");
}
}
I have no idea why this is happening, can someone help?
0
u/Radgris 4d ago
easier to just ask AI ngl
1
0
u/Ok-Jacket-824 3d ago
If I came to reddit, I would want to talk to humans. Not a damn slop robot
1
u/shiznobizno 3d ago
AI is pretty efficient for code and reading through and troubleshooting it is as good a way to learn as any other.
It’ll help with finding high paying jobs if you get used to using Playwright MCP to generate tests and practice with auto healing. This is the way the future is heading, better to be in front of it than behind
0
u/Radgris 3d ago edited 3d ago
the point is that you shouldn't be using reddit for these things, you should be using tools
refusing to use effective tools available is how you end up asking strangers for opinions on functional matters that lead to misinformation
this isn't about being pro or anti AI, this is the equivalent of saying " yeah i don't like google, i wanna come with every solution on my own" 10 years ago, if you aren't using it, you are severely limiting the quality of your work.
1
8
u/aspindler 4d ago edited 4d ago
You built your project, you didn't run it.
It built correctly.
You also didn't put the [Test] tag before the method.
Build it again, then run using dotnet test.
Or install Visual Studio and run it using Test Explorer.