โ† All prompt kits
Free ยท 17 copy-paste prompts

Playwright (JavaScript) โ€” AI Prompt Kit

Copy each prompt and paste it into ChatGPT or Claude. Work through the sections in order โ€” roadmap โ†’ concepts โ†’ code โ†’ framework โ†’ interview prep. Tell the AI your current skill level (the prompts already include that line).

Your Learning Roadmap

ROADMAP PROMPT โ€” Run this first

You are an expert SDET trainer with 15 years of experience.

I am a manual QA engineer transitioning into automation. My background:
- [X] years of manual testing experience
- Familiar with: [JIRA / test cases / regression testing / etc.]
- Programming knowledge: [none / basic / intermediate]
- Goal: become job-ready using Playwright with JavaScript
- Available study time per day: [30 mins / 1 hour / 2 hours]

Create a structured 8-10-week learning roadmap covering:
1. JavaScript fundamentals for testers (only what I need)
2. Playwright with JavaScript core concepts and architecture
3. Writing my first tests
4. Framework design and best practices
5. CI/CD integration
6. Interview preparation
7. AI concepts in testing for 2025/2026

For each week provide:
- Topic focus
- What I will be able to do by end of week
- 2-3 practice tasks
- Free resources to use

Format as a clean table then a detailed week-by-week breakdown.
Adjust timeline based on my daily study time.
Be specific โ€” this is my actual study plan, not a generic template.

Learn Concepts From Scratch

Prompt 2A-1: JavaScript Basics for Playwright Testers

You are a JavaScript instructor teaching a manual QA engineer.

Teach me only the JavaScript I need to write Playwright tests. Practical only.

Cover in order:
1. Variables (let, const โ€” when to use each)
2. Functions and arrow functions
3. Async/await โ€” critical for Playwright, explain clearly with an analogy first
4. Objects and basic destructuring
5. Arrays and common methods (map, filter, find)
6. Modules (require and import/export)
7. Error handling (try/catch)

Rules: testing analogies, one explanation + one code example each.
Start with variables. Wait for 'next' before continuing.

Prompt 2B-1: How Playwright JS Works

You are a Playwright JavaScript expert trainer.

Teach me Playwright JS core concepts for a manual tester transitioning to automation.

Cover:
1. How Playwright communicates with browsers โ€” WebSocket vs Selenium HTTP
2. Auto-waiting โ€” the 5 conditions checked before every action
3. Locators โ€” getByRole, getByText, getByLabel, getByTestId, getByPlaceholder
   Why role-based locators are the most resilient
4. Browser vs BrowserContext vs Page โ€” hierarchy with an analogy
5. playwright.config.js โ€” key settings explained simply

After each concept: one interview Q&A.
Format: Concept โ†’ Explanation โ†’ Interview Q&A

Prompt 2B-2: Writing Assertions in Playwright JS

You are a Playwright JS trainer.

Teach me how to write effective assertions in Playwright JavaScript.

Cover:
1. How expect() works with built-in retry logic
2. Most important assertions with examples:
   toBeVisible, toHaveText, toHaveValue, toBeEnabled,
   toHaveURL, toHaveTitle, toContainText, not.toBeVisible
3. Soft assertions โ€” what they are and when to use them
4. Custom assertion messages for clearer failure output

For each: what it checks, code example, common mistake to avoid.
End with: why Playwright assertions with retry beat checking values directly.

Prompt 2B-3: Handling Dynamic Elements in Playwright JS

You are a Playwright JS trainer.

Teach me how to handle dynamic elements in Playwright JavaScript.

Cover each with a code example:
1. Elements that appear after a delay or API call
2. Elements inside iframes โ€” frameLocator approach
3. File uploads with setInputFiles
4. File downloads โ€” the Promise.all pattern and why it is critical
5. Handling browser alerts and dialogs
6. Network interception with page.route() โ€” mock an API response

For each: show wrong way then correct Playwright way.
Explain WHY the correct way works.

Prompt 3A-1: Your First Playwright JS Test

You are a Playwright JavaScript trainer.

Guide me through writing my first Playwright JS test from scratch.
Use https://the-internet.herokuapp.com/login as the test site.

Step 1: Project setup โ€” npm init, install Playwright
Step 2: Complete test file with every line explained
Step 3: Each Playwright method (goto, fill, click, expect)
Step 4: Run with npx playwright test from terminal
Step 5: Open the HTML report

After the working test, give me 3 variations to try myself.
Do not give me the answers โ€” let me try first.

Prompt 3B-1: AI-Assisted Playwright JS Code Writing

You are a senior Playwright JS SDET acting as my coding partner.

I will describe a scenario in plain English.
Write the complete Playwright JS test, explain every line,
point out edge cases, suggest improvements.

My scenario: [DESCRIBE YOUR SCENARIO HERE]
Use https://www.saucedemo.com if I do not specify a site.

After writing, ask:
- Do I want negative test cases?
- Do I want this refactored into Page Object Model?
- Do I want cross-browser testing added?

Prompt 3B-2: Debug My Failing Playwright JS Test

You are an expert Playwright JS debugger.
Failing code: [PASTE HERE]
Error: [PASTE HERE]
Identify cause, explain why, show corrected code, prevent in future.
Suggest one defensive practice to add.

Build A Full Playwright Js Framework

Prompt 4-1: Framework Architecture

You are a Principal SDET expert in Playwright JavaScript frameworks.

Guide me through building a production-ready Playwright JS framework.

Cover:
1. Project folder structure โ€” exact tree
2. package.json dependencies and devDependencies
3. playwright.config.js โ€” multi-browser, multi-environment
4. Page Object Model in JavaScript with JSDoc comments
5. Custom fixtures for authentication (storage state)
6. Global setup for saving auth state once
7. GitHub Actions CI/CD workflow

Show complete structure. Explain every file.
Top 3 framework mistakes in Playwright JS?

Prompt 4-2: Page Object Model in Playwright JS

You are a Playwright JS POM expert.

Build a complete POM for login + dashboard in JavaScript.

Step 1: LoginPage class with constructor and Playwright locators
Step 2: DashboardPage class
Step 3: Test file using both page objects
Step 4: Why Playwright POM eliminates stale element errors entirely

Show all code with JSDoc comments. Give practice exercise.

Prompt 4-3: API Testing with Playwright JS

You are a Playwright JS API testing expert.

Teach me API testing with Playwright JavaScript.

Cover:
1. APIRequestContext โ€” what it is and how to use it
2. GET, POST, PUT, DELETE with JavaScript examples
3. Asserting response status, headers, and body
4. Combining API setup with UI testing โ€” the most powerful pattern
   Example: create user via API, then test in browser
5. Mocking API responses with page.route()

Show complete working examples.
Why is API + UI combined testing faster than pure UI testing?

Interview Preparation

Prompt 5-1: Mock Interview โ€” Junior Level

You are a senior SDET interviewer at a product company.

Conduct a mock Playwright JavaScript interview with me at junior SDET level.

Rules:
- Ask one question at a time
- Wait for my answer before giving feedback
- After my answer: tell me what was good, what was missing, give the ideal answer
- Ask 10 questions total

Include: 3 conceptual, 3 practical scenario, 2 comparison, 2 code-reading questions.

Start now. Ask your first question.

Prompt 5-2: Mock Interview โ€” Senior SDET Level

You are a Principal Engineer interviewing for a Senior SDET role.

Conduct a senior-level Playwright JavaScript mock interview.

Focus on: framework architecture decisions, performance and scalability,
CI/CD pipeline design, flaky test management, test strategy, mentoring.

Rules: one question at a time, wait for answer, give structured feedback.
8 questions total. Begin.

Prompt 5-3: Salary Negotiation for Automation Roles in India

You are a career coach specialising in QA and SDET roles in India.

I am transitioning to automation using Playwright JavaScript and preparing for interviews.

My profile:
- [X] years manual testing experience
- Transitioning to automation
- Target role: [SDET / Automation Engineer / Senior QA]
- Target city: [Chennai / Bangalore / Hyderabad / Remote]

Provide:
1. Current market salary range for my profile in India (2025/2026 data)
2. Exact words to say when asked for expected CTC
3. How to handle an offer below my expectation
4. What NOT to say in salary discussions
5. How to negotiate when moving from manual to automation roles

AI Concepts And AI-Assisted Testing

Prompt 6-1: AI in Testing โ€” Interview Answer Framework

You are an expert on AI in software testing.

Teach me how to answer AI-related questions in a Playwright JavaScript SDET interview.

Cover these with ideal interview answers:
1. How is AI changing test automation in 2025/2026?
2. How do you use AI tools like ChatGPT or Claude in daily testing work?
3. What is visual AI testing and which tools support it?
4. How would you test an AI-powered feature as an SDET?
5. What is self-healing test automation and how does it work?

For each: concept โ†’ interview answer โ†’ specific tool to name โ†’ the one line that impresses.
Format: Question โ†’ Concept โ†’ Answer โ†’ Key Line

Prompt 6-2: Generate Tests from Requirements Using AI

You are a senior SDET who uses AI daily in Playwright JavaScript workflows.

Teach me to generate tests from user stories using AI.

Walk through your complete workflow:
Step 1: Turn a user story into testable requirements
Step 2: Exact prompt to generate test cases from the story
Step 3: Exact prompt to turn test cases into automation code
Step 4: How to review and validate AI-generated code
Step 5: What AI gets wrong most often and how to catch it

Live example using this user story:
'As a user, I want to reset my password so I can regain
access to my account if I forget my credentials.'

Show: user story โ†’ test cases โ†’ automation code.
Then ask me to try with a story of my own.

Prompt 6-3: Build Your AI-Assisted Daily Testing Workflow

You are a senior SDET who integrates AI into daily work.

Build a practical AI-assisted workflow for my daily testing tasks.

Cover:
1. Using ChatGPT/Claude for test case generation
   - The exact prompt structure that works
   - What to provide and what AI cannot figure out alone
2. Using AI for professional bug report writing from rough notes
3. Using AI for test data generation
4. Using AI for automation code review โ€” finding anti-patterns
5. The daily AI habits of a productive SDET in 2025

End with: the one AI skill every QA engineer should master first.

Want the matching interview Q&A and coding kits for Playwright? Browse the kits โ†’

Want new prompt kits in your inbox?

Get new prompt kits, QA resources, and guides as they drop. No spam.