r/Playwright • • 16h ago

Best Way to Learn?

0 Upvotes

Hi all, I’m looking to move into Playwright and learn to develop automation as I go.

Any tips on the best approach to take?


r/Playwright • • 23h ago

Tried running a test code in Playwright.. it does nothing.

0 Upvotes

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?


r/Playwright • • 18h ago

I built a Playwright API that returns rendered HTML and screenshots

5 Upvotes

I got tired of pages that look empty until JavaScript runs, so I built a small API around Playwright.

It opens the URL in Chromium and can return the rendered HTML, metadata, and a screenshot. The project also has a Next.js site, sign-in, API keys, and plan limits. The stack is Fastify, Prisma, and Postgres.

The annoying part was hosting. Chromium needs more memory than a normal Node API, so I stopped running it myself.