Last active
July 25, 2021 07:09
-
-
Save Chandankkrr/8bc589ed523e093341c33a91c459504e to your computer and use it in GitHub Desktop.
Playwright Network Monitoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using Microsoft.Playwright; | |
namespace ConsoleApp | |
{ | |
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
const string email = "test.user@blazor.com"; | |
const string password = "Test1234#"; | |
using var playwright = await Playwright.CreateAsync(); | |
await using var browser = await playwright.Chromium.LaunchAsync(); | |
var page = await browser.NewPageAsync(); | |
page.Request += (_, request) => | |
Console.WriteLine($">> {request.Method}, {request.Url}"); | |
page.Response += (_, response) => | |
Console.WriteLine($">> {response.Status}, {response.Url}"); | |
await page.GotoAsync("https://victorious-tree-06261d500.azurestaticapps.net/register"); | |
// Fill input[type="text"] | |
await page.FillAsync("input[type=\"text\"]", email); | |
// Fill input[type="password"] | |
await page.FillAsync("input[type=\"password\"]", password); | |
// Fill text=PasswordRepeat the password >> input[type="password"] | |
await page.FillAsync("text=PasswordRepeat the password >> input[type=\"password\"]", password); | |
// Click button:has-text("Register") | |
await page.ClickAsync("button:has-text(\"Register\")"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment