
Build a robust test automation framework using Playwright in C# .NET, featuring page object model, dependency injection, spec flow BDD, and UI and API testing in CI/CD pipelines.
Run the application under test with Visual Studio 2022 or Rider, launching the web UI and API together to perform CRUD operations against a cross-platform .NET 7 and SQLite backend.
Discover the basics of test automation framework design, including reusable, maintainable, and scalable components for Playwright in C# .NET.
Explore common test automation framework types, including data driven, keyword driven, hybrid, and modular frameworks, along with data sources like json, xml, excel, and databases.
Identify components of a test automation framework, including test scripts, libraries, configurations, test data, and reporting. Leverage parallel execution and CI/CD integration with Playwright in .NET for scalable automation.
Explore common test automation patterns—page object model, factory, dependency injection, lazy loading, and dispose—and how they build a robust Playwright framework in .NET.
Introduce async programming for the playwright in C# .NET, explaining why async code is essential and how to convert synchronous code using async/await, Task, and task continuation.
Understand the foundations of asynchronous programming in C# .NET and the role of async/await in Playwright. See a demo contrasting blocking synchronous code with non-blocking async patterns.
Develop non-blocking http calls in C# with asynchronous programming, using an http client and GetAsync with await. Free the main thread to perform other work while awaiting responses.
Learn to convert synchronous code to asynchronous using Task and Task<T>, offload work with Task.Run to the thread pool, and leverage the Task Parallel Library for non-blocking web requests.
Master task continuation by using task.run and the when any method to return the first completed response in asynchronous code for playwright automation testing.
Convert task.run patterns to async/await with Task.WhenAny, replacing ContinueWith to show first completed results, and apply asynchronous execution in a Playwright–centric C# .NET workflow.
Explore lazy initialization in asynchronous programming by deferring object creation until first use, improving performance and reducing memory usage with lazy<T> in a Playwright C# .NET framework.
Explore the Playwright architecture, including how it spawns multiple browsers (chromium, chrome, edge, firefox, safari), creates isolated browser contexts, opens pages with asynchronous programming, and covers installation prerequisites.
Create a Playwright project in Visual Studio 2022 with NUnit, install the Playwright NuGet package for .NET 8, and launch Chromium.
Learn how to launch different browsers in Playwright for .NET by configuring browser type launch options, toggling headless mode, enabling devtools, and selecting chromium, firefox, or webkit channels including edge.
Refactor test setup by moving browser initialization into an async initialize playwright method inside a driver class, returning an IPage, and use await for page actions like clicking links.
Externalize Playwright browser options in a C# .NET project by introducing a test settings POCO with headless, dev tools, channel, and slomo, and pass it to initialize playwright async.
Refactor the initialize Playwright method to support multiple browsers by introducing a driver type enum and using a switch expression to select Chromium, Chrome, Firefox, Edge, or WebKit.
Explore how channels in browser type launch options control chromium-based runners to open firefox or edge, highlighting that channels—not the edge browser itself—require the chromium driver.
Explore building framework components for an automation framework with Playwright in C# .NET, using the single responsibility principle, interfaces, and lazy initialization, and separating framework code from test code.
Move Playwright setup into an NUnit fixture using setup, expose a private underscore page field, and run login tests with get by label and aria label for username and password.
Dispose Playwright resources by exposing the browser, browser context, and page for test access, and use close and dispose in teardown. Prevent memory leaks and ensure per-test cleanup.
This lecture demonstrates moving initialization into the Playwright driver constructor, using Task.Run to call initialize Playwright async, and exposing a public page property to simplify tests.
Apply the single responsibility principle to refactor the initialize Playwright driver into dedicated create browser context and create page methods, building a reusable, scalable Playwright framework in C# .NET.
Refactor the automation framework by encapsulating page access with private read-only properties and a public page accessor using a lambda, exposing page and browser context results safely.
Apply the single responsibility principle to the get browser async flow by extracting chrome driver setup into a dedicated playwright driver initializer with configurable launch options (timeout, headless, slo-mo, args).
Configure async browser drivers for Chrome, Firefox, WebKit, Chromium, and Edge by passing args, timeouts, and channels via Playwright in .NET, using interfaces and dependency injection concepts.
Design a browser interface in Playwright using interfaces, extract the driver initializer interface, and implement chromium, firefox, and edge drivers for clean, contract-driven code.
Fix the test code by passing an IPlaywrightDriverInitializer to the playwright driver constructor so tests run, and discuss lazy initialization to avoid Task.Run overhead.
Discover how lazy initialization defers Playwright browser, browser context, and page creation until required, avoiding Task.Run in constructors and using async lazy patterns for cleaner, faster code.
Implement lazy initialization with Task.Factory to create async task wrappers for Playwright objects, wiring awaiters and awaitable pages and browsers in the framework.
Separate framework and test code by creating distinct projects for tests and framework, migrating Playwright setup, and wiring dependencies for context injection and data-driven testing in .NET.
Implement the IDisposable interface in xUnit to properly dispose Playwright resources by following the dispose pattern, closing and disposing the browser context when needed.
Run end-to-end test in XUnit with IClassFixture and IDisposable to handle setup and teardown, using constructor-based initialization and dependency injection to manage the Playwright driver, login, and employee list interactions.
Switch to Rider IDE for cross-platform dotnet development on macOS, keeping the same Playwright-based framework and NuGet dependencies, with identical test workflows and Visual Studio parity.
Learn to centralize test configurations by moving hardcoded values to a dotnet appsettings.json file, enabling centralized control of driver choices, timeouts, and headless mode across tests.
Create and configure an appsettings.json file, set up copy to output, and implement a config reader to deserialize settings with case-insensitive properties and enum conversion for Playwright tests.
Centralize test settings with a config reader to drive Playwright in .NET, selecting Firefox or Chromium and headless mode from configuration, and apply the application URL across tests.
Build maintainable tests in Playwright with a page object model in C# .NET, using a test generator for record and playback.
Create a page object model in Playwright for .NET by building product list page and product page classes, defining locators and an IPage constructor, and implementing a create product workflow.
Applies a continued page object model approach to creating a product in Playwright in C# .NET, including a typed product model, form fills, create actions, and list verification.
Learn to run page object model based tests with Playwright in C# .NET, including creating products, clicking in the grid, awaiting actions, and asserting results.
Use Playwright's expect library to perform locator assertions, such as to be visible for a product located by text, and apply exact as true to avoid duplicates.
Explore data driven testing in c sharp with xunit theory and inline data to replace hard coded values with parameterized product data, including name, description, price, and product type.
Replace inline data with a concrete product type in C# .NET Playwright tests by introducing a product model (id, name, description, price) and using it as the test data.
Leverage AutoFixture to generate randomized data for test cases, enabling data driven testing with xUnit and avoiding hard coded values.
Understand dependency injection to decouple object creation from execution and enable inversion of control for testable code. Learn how ASP.NET Core uses containers, interfaces, and lifetimes transient, scoped, and singleton.
Discover how to apply ex unit dependency injection in .NET by registering services in Startup.ConfigureServices with transient, scoped, and singleton lifetimes for the playwright driver, settings, and utilities.
Extract an interface from the playwright driver and register it with dependency injection in startup, exposing page, browser, and browser context while removing boilerplate and using scoped and singleton services.
Demonstrates refactoring the page object model with dependency injection by extracting interfaces for product list and product page, registering them in startup, and simplifying with a Playwright driver page property.
Demonstrates separation of concern by moving playwright driver and test settings into a dedicated fixture, using dependency injection and a test page interface to drive navigation and assertions.
Automation framework development with Playwright in C#.NET is an advanced course designed to address End-to-End test framework development with clean coding and SOLID patterns in place.
The curriculum of this course is designed not just by randomly choosing some of the topics that I know, the course has evolved over a period (20+ years) by giving training to more than 360,000+ professionals (both online and corporate training) and working in automation testing field 20+ years now
Hence the course is much-refined version, meaning the course won't deviate from the topics it is meant to be.
The course includes all the source codes which we will discuss in the course, hence one must have all the source codes required at the end of every section.
Finally, the course is for those, who are serious about automation testing framework development from the complete ground up and understand all the nuts and bots of building them for extensible usage at work
In this course, you will learn to automate ASP NET Web API and WebUI projects using tools such as
Playwright (latest version)
.NET 8
C# 12
XUnit
AutoFixture
Fluent Assertion
Specflow
Extent Reports
We will also be using the following patterns and concepts in this course
Dependency Injection
Factory Pattern
Page Object Model Pattern
Lazy Initialization
Separation of Concerns
Single Responsibility Principle
Dispose Pattern
Asynchronous programming
At the end of this course, you will have
Complete understanding of C# with .NET 8
Complete understanding of Playwright with latest and greatest changes
Designing a complete framework from the ground up
All the idea to design a more extendable framework
CI/CD with Playwright
Reporting for Playwright with Extent Reports
You can directly apply all the concepts from the course at your work with very less code change in the framework and start using it as your test automation framework to test and improve quality of your applications.