Business Analysis · Playwright for BAs
Why Every Business Analyst Should Learn Playwright in 2026
Quick summary — why business analysts should learn Playwright
Every business analyst should learn Playwright in 2026 to verify requirements directly, not just document them. Playwright's codegen tool records your clicks into a script, its assertions check acceptance criteria automatically, and its screenshots and HTML reports provide evidence for UAT sign-off. A BA does not need to become a test engineer — just comfortable enough to record, read and run simple checks.
In this guide you will learn:
- Why BAs benefit — closing the gap between requirements and testing.
- Recording flows with codegen — turn a click-through into a script.
- Acceptance criteria as checks — Given/When/Then mapped to assertions.
- BA-friendly templates — UAT checklist, criteria map and screenshot script.
- Interview questions — how to discuss automation as a BA.
SECTION 01Why Playwright is useful for business analysts
Business analysts sit between stakeholders and developers. You turn business needs into user stories and acceptance criteria, then wait for testers to confirm the build matches. When something is missed, it is often because the written criteria and the tested behaviour drifted apart.
Playwright is an open-source browser automation framework from Microsoft. Its codegen tool records what you do in a browser and writes the script for you. That makes it approachable for a BA: you can turn your own acceptance criteria into checks, run them during UAT, and capture screenshots for documentation — without a deep programming background.
| BA activity | Pain today | How Playwright helps | Outcome |
|---|---|---|---|
| Writing acceptance criteria | Criteria are interpreted differently | Criteria become runnable checks | One shared definition of done |
| UAT preparation | Manual click-throughs every release | Recorded journeys replay in minutes | Faster, repeatable UAT |
| Documentation | Screenshots go out of date | Script recaptures screens on demand | Current user guides |
| Defect reporting | Hard to reproduce steps | Trace file shows every step | Clearer bug reports |
# One-time setup (Python version of Playwright)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install pytest-playwright
playwright install chromium
# Check it works
playwright --version
# Open a browser and record your clicks into Python code
playwright codegen --target python-pytest https://demo.playwright.dev/todomvc
# What happens:
# 1. A browser window opens on the page
# 2. An Inspector window shows code as you click and type
# 3. Copy the generated test into a file, e.g. test_todo.py
# 4. Add expect() checks for your acceptance criteria
SECTION 02Turning acceptance criteria into Playwright checks
Most agile teams write acceptance criteria in a Given / When / Then format. That structure maps naturally to an automated check: Given sets up the page, When performs the user actions, and Then becomes one or more expect() assertions.
Writing criteria with automation in mind also improves the criteria themselves. "The page should look correct" cannot be checked; "the cart shows 2 items and a total of ₹1,200" can. If you cannot write an assertion for a criterion, it is probably too vague for developers too.
| Criterion part | Example wording | Playwright step | Tip |
|---|---|---|---|
| Given | Given I am on the to-do page | page.goto(url) | Start every check from a known state |
| When | When I add "Pay electricity bill" | fill() then press("Enter") | Use visible labels or placeholders |
| Then | Then it appears in the list | expect(locator).to_have_text() | Check what the user would see |
| And | And the counter shows 1 item left | expect(counter).to_have_text() | One clear assertion per rule |
User story:
As a busy user, I want to add tasks to my to-do list
so that I do not forget them.
Acceptance criteria:
AC1 Given I am on the to-do page
When I add "Pay electricity bill"
Then it appears in the list
And the counter shows "1 item left"
AC2 Given I have added two tasks
When I mark one as complete
Then the counter shows "1 item left"
# test_todo.py — run with: pytest test_todo.py
from playwright.sync_api import Page, expect
URL = "https://demo.playwright.dev/todomvc"
def add_task(page: Page, text: str):
page.get_by_placeholder("What needs to be done?").fill(text)
page.get_by_placeholder("What needs to be done?").press("Enter")
def test_ac1_new_task_appears(page: Page):
page.goto(URL)
add_task(page, "Pay electricity bill")
expect(page.get_by_test_id("todo-title")).to_have_text(["Pay electricity bill"])
expect(page.get_by_test_id("todo-count")).to_have_text("1 item left")
def test_ac2_completing_reduces_counter(page: Page):
page.goto(URL)
add_task(page, "Book train ticket")
add_task(page, "Call bank")
page.get_by_test_id("todo-item").first.get_by_role("checkbox").check()
expect(page.get_by_test_id("todo-count")).to_have_text("1 item left")
SECTION 03Using Playwright for UAT, screenshots and evidence
User acceptance testing often means stakeholders clicking through the same journeys release after release. With a small Playwright suite, you can run those journeys before the UAT session, so stakeholders spend their time on judgement — "is this what we need?" — rather than repetitive clicking.
Playwright can also take full-page screenshots, record traces with every step and network call, and produce an HTML report. These outputs become evidence for sign-off and up-to-date images for training guides and functional specifications.
| Output | How to produce it | Who uses it | Where it goes |
|---|---|---|---|
| HTML report | pytest with pytest-html, or npx playwright test in JS | BA, QA, product owner | UAT sign-off pack |
| Screenshots | page.screenshot(full_page=True) | BA, trainers | User guides, specs |
| Trace file | pytest --tracing on | Developers | Bug reports |
| Video | pytest --video on | Stakeholders | Demo of a failing step |
# capture_screens.py — refresh screenshots for the user guide
from playwright.sync_api import sync_playwright
PAGES = {
"home": "https://demo.playwright.dev/todomvc",
}
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(viewport={"width": 1280, "height": 800})
for name, url in PAGES.items():
page.goto(url)
page.screenshot(path=f"screens/{name}.png", full_page=True)
browser.close()
# Create the folder first: mkdir screens
# Run all checks in a visible browser (good for demos)
pytest --headed
# Keep a trace for failed tests (open with: playwright show-trace <file>)
pytest --tracing retain-on-failure
# Record video of failures
pytest --video retain-on-failure
# Screenshot on failure
pytest --screenshot only-on-failure
SECTION 04BA templates for Playwright-backed UAT
These templates connect your requirement documents to automated checks and UAT evidence.
ACCEPTANCE CRITERIA MAP
Story ID | AC ID | Criterion (short) | Test name | Status
---------|-------|------------------------------|-----------------------------------|-------
US-101 | AC1 | New task appears in list | test_ac1_new_task_appears | Pass
US-101 | AC2 | Completing reduces counter | test_ac2_completing_reduces_counter | Pass
US-102 | AC1 | ____________________________ | _________________________________ | ____
UAT READINESS CHECKLIST
[ ] All stories in scope have acceptance criteria
[ ] Key journeys have Playwright checks
[ ] Checks run green on the UAT build
[ ] HTML report saved for this build
[ ] Screenshots refreshed for changed screens
[ ] Known issues listed with owners
[ ] Stakeholder session booked with agenda
UAT SIGN-OFF NOTE
Release : ____________ Build: ________
Scope : Stories US-___ to US-___
Automated checks: __ passed / __ failed
Manual review : completed by ____________
Open issues : ____________________________
Decision : Approved / Approved with conditions / Rejected
Signed by : ____________ Date: ________
SECTION 05Tips for business analysts learning Playwright
Get value quickly without turning into a full-time automation engineer:
- Start with one journey — pick the most important user flow and automate only that first.
- Use role and label locators — get_by_role and get_by_label match how users see the page and break less often.
- Write testable criteria — replace words like 'correct' or 'fast' with visible, measurable outcomes.
- Partner with QA — share your scripts so testers can extend them into the main suite.
- Practise on demo sites — demo.playwright.dev is safe for learning before you touch your company's app.
SECTION 06Interview Q&A — automation skills for BAs
Q1Why would a business analyst learn a test automation tool?
It lets me verify that acceptance criteria are actually met, speeds up UAT preparation and keeps documentation screenshots current. It also improves how I write criteria, because I think about what can be checked.
Q2How do acceptance criteria relate to automated tests?
Each criterion describes an observable outcome. In a Given/When/Then format, Given sets up the state, When performs actions and Then becomes assertions in the automated check.
Q3What is Playwright codegen?
It is a recorder that opens a browser, watches your clicks and typing, and generates test code in languages such as Python, JavaScript or Java. It is a quick way to create a first draft of a test.
Q4What makes an acceptance criterion testable?
It describes a specific, observable result — a message, a value, a count, a page state — rather than a subjective quality. For example, 'shows an error saying the email is invalid' instead of 'handles bad input properly'.
Q5How would you use automation during UAT?
I would run automated checks on key journeys before the session, share the report, and let stakeholders focus on business judgement and edge cases rather than repeating routine clicks.
SECTION 07Test yourself — Playwright for business analysts
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
Do business analysts need coding skills?
Not deep coding. But basic scripting, SQL and comfort with simple automation tools help BAs verify requirements, analyse data and work more closely with developers and testers.
Is Playwright easy for non-programmers?
Its codegen recorder makes a first script easy to create. Understanding and editing that script needs basic programming concepts, which most people can learn in a few weeks of practice.
What is the difference between UAT and QA testing?
QA testing checks that software works correctly against specifications, often in detail. UAT checks that the software meets business needs and is acceptable to the people who will use it.
Should a business analyst learn Playwright or Selenium?
Playwright is often easier to start with thanks to codegen, auto-waiting and built-in reports. Selenium is widely used too. For a BA, the tool your QA team already uses is usually the best choice.
Can Playwright take screenshots for documentation?
Yes. page.screenshot() captures the visible page or the full page, and a small script can refresh every screenshot in a user guide whenever the interface changes.
SECTION 09Related reads
Classroom & online · Noida
Grow your business analyst toolkit
Our Business Analyst Training Course covers requirements, user stories, acceptance criteria, process modelling and data skills used by working BAs.
Talk to a counsellor for current fees- Requirements & user stories
- UAT & acceptance criteria
- Mock interviews
- Weekday & weekend batches