Prompt Buddy logoPrompt Buddy

playwright · Playwright Docs

Playwright Test

A comprehensive guide to setting up the Playwright framework, identifying web elements using resilient locators, and implementing end-to-end test workflows including user interactions, assertions, and lifecycle manage...

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Playwright Test

A comprehensive guide to setting up the Playwright framework, identifying web elements using resilient locators, and implementing end-to-end test workflows including user interactions, assertions, and lifecycle manage...

When To Use

Use when you need to set up a new Playwright environment, select web elements using accessibility-based locators, or implement end-to-end test scripts with user actions and assertions.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/installation-docs-intro/workflow-guide.mdA guide covering the installation of Playwright Test using npm, yarn, pnpm, and the VS Code extension.Questions about a guide covering the installation of Playwright Test using npm, yarn, pnpm, and the VS Code extension.
examples/installation-docs-intro/playwright-installation-npm-init-command.textThe shell command used to initialize a new Playwright project using npm.Exact payloads, commands, or snippets shown in The shell command used to initialize a new Playwright project using npm.
examples/installation-docs-intro/playwright-installation-yarn-create-command.textThe shell command used to initialize a new Playwright project using yarn create.Exact payloads, commands, or snippets shown in The shell command used to initialize a new Playwright project using yarn create.
examples/installation-docs-intro/playwright-installation-pnpm-command.textThe shell command used to initialize a new Playwright project using pnpm.Exact payloads, commands, or snippets shown in The shell command used to initialize a new Playwright project using pnpm.
examples/installation-docs-intro/playwright-installation-project-structure.textA text representation of the standard file structure and configuration files created during a Playwright installation.Exact payloads, commands, or snippets shown in A text representation of the standard file structure and configuration files created during a Playwright installation.
examples/installation-docs-intro/playwright-installation-npx-command.textThe shell command used to install Playwright via the npx package runner.Exact payloads, commands, or snippets shown in The shell command used to install Playwright via the npx package runner.
examples/installation-docs-intro/playwright-installation-yarn-test-command.textA text snippet demonstrating the yarn command used to run playwright tests during installation.Exact payloads, commands, or snippets shown in A text snippet demonstrating the yarn command used to run playwright tests during installation.
examples/installation-docs-intro/playwright-installation-pnpm-test-command.textThe shell command used to execute playwright tests using the pnpm package manager.Exact payloads, commands, or snippets shown in The shell command used to execute playwright tests using the pnpm package manager.
examples/installation-docs-intro/playwright-show-report-command.textA text snippet demonstrating the command to display the Playwright test report.Exact payloads, commands, or snippets shown in A text snippet demonstrating the command to display the Playwright test report.
examples/installation-docs-intro/playwright-show-report-command-2.textA text command demonstrating how to use yarn to display the Playwright test report.Exact payloads, commands, or snippets shown in A text command demonstrating how to use yarn to display the Playwright test report.
examples/installation-docs-intro/playwright-show-report-command-3.textA text snippet demonstrating the command to launch the Playwright HTML report using pnpm.Exact payloads, commands, or snippets shown in A text snippet demonstrating the command to launch the Playwright HTML report using pnpm.
examples/installation-docs-intro/playwright-ui-mode-installation-command.textThe shell command used to launch the Playwright UI mode test runner.Exact payloads, commands, or snippets shown in The shell command used to launch the Playwright UI mode test runner.
examples/installation-docs-intro/playwright-install-ui-mode-command.textThe shell command used to run Playwright tests in UI mode using yarn.Exact payloads, commands, or snippets shown in The shell command used to run Playwright tests in UI mode using yarn.
examples/installation-docs-intro/playwright-ui-mode-execution-command.textThe terminal command used to launch the Playwright UI mode using pnpm.Exact payloads, commands, or snippets shown in The terminal command used to launch the Playwright UI mode using pnpm.
examples/installation-docs-intro/playwright-installation-npm-commands.textThe shell commands required to install the Playwright test runner and its necessary browser dependencies using npm.Exact payloads, commands, or snippets shown in The shell commands required to install the Playwright test runner and its necessary browser dependencies using npm.
examples/installation-docs-intro/playwright-installation-commands.textShell commands to add the Playwright test package and install required browser dependencies using yarn.Exact payloads, commands, or snippets shown in Shell commands to add the Playwright test package and install required browser dependencies using yarn.
examples/installation-docs-intro/playwright-installation-pnpm-commands.textShell commands to install the Playwright test package and its required browser dependencies using pnpm.Exact payloads, commands, or snippets shown in Shell commands to install the Playwright test package and its required browser dependencies using pnpm.
examples/installation-docs-intro/playwright-cli-version-check-command.textA command line instruction to verify the installed Playwright version using the npx command.Exact payloads, commands, or snippets shown in A command line instruction to verify the installed Playwright version using the npx command.
examples/installation-docs-intro/playwright-install-version-command.textA command line instruction using yarn to check the installed version of Playwright.Exact payloads, commands, or snippets shown in A command line instruction using yarn to check the installed version of Playwright.
examples/installation-docs-intro/playwright-install-version-check-command.textA command line instruction to verify the installed Playwright version using pnpm.Exact payloads, commands, or snippets shown in A command line instruction to verify the installed Playwright version using pnpm.
docs/locators-docs/workflow-guide.mdA guide explaining the core concepts, auto-waiting capabilities, and recommended built-in locator methods in Playwright.Questions about a guide explaining the core concepts, auto-waiting capabilities, and recommended built-in locator methods in Playwright.
examples/locators-docs/playwright-locators-usage-examples.textCode examples demonstrating how to use various Playwright locator methods like getByLabel, getByRole, and getByText to interact with web elements.Exact payloads, commands, or snippets shown in Code examples demonstrating how to use various Playwright locator methods like getByLabel, getByRole, and getByText t...
examples/locators-docs/playwright-locators-button.textA text-based example demonstrating how to locate a button element using its visible sign in text.Exact payloads, commands, or snippets shown in A text-based example demonstrating how to locate a button element using its visible sign in text.
examples/locators-docs/playwright-locators-getbyrole-click.textA code snippet demonstrating how to use the getByRole locator to find and click a sign-in button in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByRole locator to find and click a sign-in button in Playwright.
examples/locators-docs/playwright-locators-getbyrole-javascript.textA JavaScript code snippet demonstrating how to use the getByRole locator to hover over and click a sign-in button.Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to use the getByRole locator to hover over and click a sign-in button.
examples/locators-docs/playwright-locators-frame-role-click.textA code snippet demonstrating how to locate an element within an iframe using frameLocator and getByRole before performing a click action.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to locate an element within an iframe using frameLocator and getByRole before perfor...
examples/locators-docs/playwright-locators-html-sign-up-form.textAn HTML snippet containing a sign up form with a checkbox and a submit button used to demonstrate locator selection.Exact payloads, commands, or snippets shown in An HTML snippet containing a sign up form with a checkbox and a submit button used to demonstrate locator selection.
examples/locators-docs/playwright-locators-role-assertion-examples.textCode examples demonstrating how to use Playwright locators with getByRole to find and interact with web elements.Exact payloads, commands, or snippets shown in Code examples demonstrating how to use Playwright locators with getByRole to find and interact with web elements.
examples/locators-docs/playwright-locators-label-input.textA text example demonstrating how to locate an input element using its associated label text.Exact payloads, commands, or snippets shown in A text example demonstrating how to locate an input element using its associated label text.
examples/locators-docs/playwright-locators-getbylabel-usage.textA text example demonstrating the use of the getByLabel locator to interact with a password input field in Playwright.Exact payloads, commands, or snippets shown in A text example demonstrating the use of the getByLabel locator to interact with a password input field in Playwright.
examples/locators-docs/playwright-locators-input-element.textA text representation of an HTML input element used to demonstrate locator selection strategies.Exact payloads, commands, or snippets shown in A text representation of an HTML input element used to demonstrate locator selection strategies.
examples/locators-docs/playwright-locators-getbyplaceholder.textA code snippet demonstrating how to use the getByPlaceholder locator to fill an input field in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByPlaceholder locator to fill an input field in Playwright.
examples/locators-docs/playwright-locators-text-selector.textA text-based locator example demonstrating how to select an element containing the string 'Welcome, John'.Exact payloads, commands, or snippets shown in A text-based locator example demonstrating how to select an element containing the string 'Welcome, John'.
examples/locators-docs/playwright-locators-getbytext-assertion.textA code snippet demonstrating how to use the getByText locator with an expect assertion to verify element visibility.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByText locator with an expect assertion to verify element visibility.
examples/locators-docs/playwright-locators-getbytext-assertion-2.textA code snippet demonstrating how to use the getByText locator with an exact match assertion in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByText locator with an exact match assertion in Playwright.
examples/locators-docs/playwright-locators-getbytext-regex-assertion.textA code snippet demonstrating how to use the getByText locator with a regular expression to assert visibility in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByText locator with a regular expression to assert visibility in Playw...
examples/locators-docs/playwright-locators-overview.textA text-based overview of Playwright locator concepts and usage patterns from the official documentation.Exact payloads, commands, or snippets shown in A text-based overview of Playwright locator concepts and usage patterns from the official documentation.
examples/locators-docs/playwright-locators-getbyalttext-usage.textA code example demonstrating how to use the getByAltText locator to interact with an element in Playwright.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the getByAltText locator to interact with an element in Playwright.
examples/locators-docs/playwright-locators-documentation-overview.textA text-based overview of the Locators concept and usage within the Playwright documentation.Exact payloads, commands, or snippets shown in A text-based overview of the Locators concept and usage within the Playwright documentation.
examples/locators-docs/playwright-locators-getbytitle-assertion.textA code snippet demonstrating how to use the getByTitle locator with an assertion to verify text content in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByTitle locator with an assertion to verify text content in Playwright.
examples/locators-docs/playwright-locators-get-by-test-id.textA text example demonstrating how to use the getByTestId locator to select an element with a specific data-testid attribute.Exact payloads, commands, or snippets shown in A text example demonstrating how to use the getByTestId locator to select an element with a specific data-testid attr...
examples/locators-docs/playwright-locators-getbytestid.textA code snippet demonstrating the use of the getByTestId locator in Playwright to interact with an element.Exact payloads, commands, or snippets shown in A code snippet demonstrating the use of the getByTestId locator in Playwright to interact with an element.
examples/locators-docs/playwright-locators-testid-attribute-config.textA Playwright configuration example demonstrating how to set a custom testIdAttribute for locators.Exact payloads, commands, or snippets shown in A Playwright configuration example demonstrating how to set a custom testIdAttribute for locators.
examples/locators-docs/playwright-locators-button-data-attribute.textA text example demonstrating how to locate a button element using a custom data attribute.Exact payloads, commands, or snippets shown in A text example demonstrating how to locate a button element using a custom data attribute.
examples/locators-docs/playwright-locators-usage-examples-2.textA collection of code snippets demonstrating various Playwright locator syntax including CSS, XPath, and text selectors.Exact payloads, commands, or snippets shown in A collection of code snippets demonstrating various Playwright locator syntax including CSS, XPath, and text selectors.
examples/locators-docs/playwright-locators-css-and-xpath-examples.textCode examples demonstrating how to use CSS selectors and XPath within Playwright locator methods.Exact payloads, commands, or snippets shown in Code examples demonstrating how to use CSS selectors and XPath within Playwright locator methods.
examples/locators-docs/playwright-locators-documentation-overview-2.textA text-based overview of the Locators concept and usage within the Playwright documentation.Exact payloads, commands, or snippets shown in A text-based overview of the Locators concept and usage within the Playwright documentation.
examples/locators-docs/playwright-locators-getbytext-usage.textA code example demonstrating how to use the getByText locator to find and interact with elements in Playwright.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the getByText locator to find and interact with elements in Playwright.
examples/locators-docs/playwright-locators-has-text-option.textA code snippet demonstrating how to use the hasText option within a Playwright locator to select an element containing specific text.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the hasText option within a Playwright locator to select an element containin...
examples/locators-docs/playwright-locators-assertion.textA text snippet demonstrating how to use the page.locator method with an expect assertion to verify text content.Exact payloads, commands, or snippets shown in A text snippet demonstrating how to use the page.locator method with an expect assertion to verify text content.
examples/locators-docs/playwright-locators-html-structure.textAn HTML snippet demonstrating a list of products with headings and buttons to illustrate locator targeting.Exact payloads, commands, or snippets shown in An HTML snippet demonstrating a list of products with headings and buttons to illustrate locator targeting.
examples/locators-docs/playwright-locators-getbyrole-filter-click.textA code snippet demonstrating how to chain getByRole and filter methods to click a specific button within a list item.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to chain getByRole and filter methods to click a specific button within a list item.
examples/locators-docs/playwright-locators-getbyrole-filter-click-2.textA Playwright code snippet demonstrating how to chain getByRole and filter locators to click a specific button within a list item.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to chain getByRole and filter locators to click a specific button within...
examples/locators-docs/playwright-locators-filter-hasnottext.textA Playwright code snippet demonstrating how to use the filter method with the hasNotText option to locate elements that do not contain specific text.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to use the filter method with the hasNotText option to locate elements th...
examples/locators-docs/playwright-locators-filter-by-role.textA Playwright code snippet demonstrating how to use the filter method to locate a specific list item containing a heading and then clicking a button within it.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to use the filter method to locate a specific list item containing a head...
examples/locators-docs/playwright-locators-filter-by-role-2.textA Playwright code snippet demonstrating how to use the filter method with getByRole to locate a list item containing a specific heading.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to use the filter method with getByRole to locate a list item containing...
examples/locators-docs/playwright-locators-filter-role-incorrect-usage.textAn example demonstrating an incorrect way to use the filter method with nested role locators in Playwright.Exact payloads, commands, or snippets shown in An example demonstrating an incorrect way to use the filter method with nested role locators in Playwright.
examples/locators-docs/playwright-locators-filter-hasnot.textA Playwright code snippet demonstrating how to use the filter method with the hasNot option to exclude specific elements from a locator.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to use the filter method with the hasNot option to exclude specific eleme...
examples/locators-docs/playwright-locators-filter-getbyrole.textA code snippet demonstrating how to use the getByRole locator combined with the filter method to select a specific list item and its child button.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByRole locator combined with the filter method to select a specific li...
examples/locators-docs/playwright-locators-api-usage-examples.textCode examples demonstrating various Playwright locator methods such as getByRole and getByTestId for interacting with web elements.Exact payloads, commands, or snippets shown in Code examples demonstrating various Playwright locator methods such as getByRole and getByTestId for interacting with...
examples/locators-docs/playwright-locators-getbyrole-and-getbytitle.textA code snippet demonstrating how to chain locators using the getByRole and getByTitle methods in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to chain locators using the getByRole and getByTitle methods in Playwright.
examples/locators-docs/playwright-locators-role-and-text-usage.textA code example demonstrating how to use getByRole, getByText, and the or locator method to interact with UI elements.Exact payloads, commands, or snippets shown in A code example demonstrating how to use getByRole, getByText, and the or locator method to interact with UI elements.
examples/locators-docs/playwright-locators-visibility.textA text representation of HTML elements used to demonstrate locating visible versus invisible buttons in Playwright.Exact payloads, commands, or snippets shown in A text representation of HTML elements used to demonstrate locating visible versus invisible buttons in Playwright.
examples/locators-docs/playwright-locators-basic-usage.textA basic code example demonstrating how to use the page.locator method to select and interact with elements in Playwright.Exact payloads, commands, or snippets shown in A basic code example demonstrating how to use the page.locator method to select and interact with elements in Playwri...
examples/locators-docs/playwright-locators-filter-visible.textA code snippet demonstrating how to use the filter method with the visible option on a Playwright locator.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the filter method with the visible option on a Playwright locator.
examples/locators-docs/playwright-locators-html-list-element-selection.textAn HTML snippet containing a list of fruit items used to demonstrate locating elements within a list structure.Exact payloads, commands, or snippets shown in An HTML snippet containing a list of fruit items used to demonstrate locating elements within a list structure.
examples/locators-docs/playwright-locators-usage-examples-3.textA collection of Playwright locator usage examples demonstrating how to find elements using various methods like getByRole and toHaveCount.Exact payloads, commands, or snippets shown in A collection of Playwright locator usage examples demonstrating how to find elements using various methods like getBy...
examples/locators-docs/playwright-locators-getbyrole-text-assertion.textA code snippet demonstrating how to use the getByRole locator with toHaveText to assert multiple list item values.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByRole locator with toHaveText to assert multiple list item values.
examples/locators-docs/playwright-locators-getbytext-usage-2.textA code snippet demonstrating how to use the getByText locator to find and click an element in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByText locator to find and click an element in Playwright.
examples/locators-docs/playwright-locators-getbyrole-filter.textA code snippet demonstrating how to use the getByRole locator combined with the filter method to select a specific list item by text.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByRole locator combined with the filter method to select a specific li...
examples/locators-docs/playwright-locators-testid-html-structure.textAn HTML snippet containing a list of items with data-testid attributes used to demonstrate locator selection.Exact payloads, commands, or snippets shown in An HTML snippet containing a list of items with data-testid attributes used to demonstrate locator selection.
examples/locators-docs/playwright-locators-getbytestid-usage.textA text example demonstrating the use of the getByTestId locator method in Playwright.Exact payloads, commands, or snippets shown in A text example demonstrating the use of the getByTestId locator method in Playwright.
examples/locators-docs/playwright-locators-javascript-role-nth.textA JavaScript code snippet demonstrating how to use the getByRole locator with the nth method to select a specific list item.Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to use the getByRole locator with the nth method to select a specific lis...
examples/locators-docs/playwright-locators-html-structure-2.textAn HTML snippet demonstrating a list of user elements with buttons to illustrate locator targeting.Exact payloads, commands, or snippets shown in An HTML snippet demonstrating a list of user elements with buttons to illustrate locator targeting.
examples/locators-docs/playwright-locators-filter-by-text-and-role.textA Playwright code snippet demonstrating how to locate an element by filtering a list item using text and a nested button role.Exact payloads, commands, or snippets shown in A Playwright code snippet demonstrating how to locate an element by filtering a list item using text and a nested but...
examples/locators-docs/playwright-locators-getbyrole-all-iteration.textA code snippet demonstrating how to iterate through multiple elements found using the getByRole locator in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to iterate through multiple elements found using the getByRole locator in Playwright.
examples/locators-docs/playwright-locators-getbyrole-iteration-javascript.textA JavaScript code snippet demonstrating how to use getByRole to locate multiple list items and iterate through them using a loop.Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to use getByRole to locate multiple list items and iterate through them u...
examples/locators-docs/playwright-locators-get.textA code snippet demonstrating how to use getByRole and evaluateAll to retrieve text content from multiple list items using Playwright locators.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use getByRole and evaluateAll to retrieve text content from multiple list items u...
examples/locators-docs/playwright-locators-usage-examples-4.textA collection of code examples demonstrating various Playwright locator methods such as getByRole and getByText.Exact payloads, commands, or snippets shown in A collection of code examples demonstrating various Playwright locator methods such as getByRole and getByText.
examples/locators-docs/playwright-locators-getbyrole-count.textA code snippet demonstrating how to use the getByRole locator to count elements on a page using Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getByRole locator to count elements on a page using Playwright.
docs/writing-tests-docs/workflow-guide.mdA guide covering the fundamentals of writing Playwright tests, including basic actions, interactions, and assertions.Questions about a guide covering the fundamentals of writing Playwright tests, including basic actions, interactions, and assertions.
examples/writing-tests-docs/playwright-writing-tests-basic.textA basic Playwright test script demonstrating how to import test utilities, navigate to a URL, and assert a page title.Exact payloads, commands, or snippets shown in A basic Playwright test script demonstrating how to import test utilities, navigate to a URL, and assert a page title.
examples/writing-tests-docs/playwright-writing-tests-basic-navigation.textA basic Playwright test example demonstrating how to navigate to a URL using the page.goto command.Exact payloads, commands, or snippets shown in A basic Playwright test example demonstrating how to navigate to a URL using the page.goto command.
examples/writing-tests-docs/playwright-writing-tests-locator-click.textA code snippet demonstrating how to create a locator using getByRole and perform a click action in Playwright.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to create a locator using getByRole and perform a click action in Playwright.
examples/writing-tests-docs/playwright-writing-tests-locators.textA text-based example demonstrating how to use the getByRole locator to interact with elements in Playwright.Exact payloads, commands, or snippets shown in A text-based example demonstrating how to use the getByRole locator to interact with elements in Playwright.
examples/writing-tests-docs/playwright-writing-tests-expect-assertions.textA text example demonstrating the use of web-first assertions like toHaveTitle in Playwright tests.Exact payloads, commands, or snippets shown in A text example demonstrating the use of web-first assertions like toHaveTitle in Playwright tests.
examples/writing-tests-docs/playwright-writing-tests-expect-assertion.textA text example demonstrating the use of the expect assertion in Playwright tests.Exact payloads, commands, or snippets shown in A text example demonstrating the use of the expect assertion in Playwright tests.
examples/writing-tests-docs/playwright-writing-tests-basic-2.textA basic Playwright test script demonstrating the use of the test function and page fixture to perform an automated browser action.Exact payloads, commands, or snippets shown in A basic Playwright test script demonstrating the use of the test function and page fixture to perform an automated br...
examples/writing-tests-docs/playwright-writing-tests-javascript.textA JavaScript code example demonstrating basic test structure using test.describe, test.beforeEach, and navigation assertions.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating basic test structure using test.describe, test.beforeEach, and navigation ass...

What This Skill Covers

  • Installation: - Getting Started Installation On this page # Installation ## Introduction ​ Playwright Test is an end-to-end test framework for modern web apps. It bundles...
  • Locators: - Guides Locators On this page # Locators ## Introduction ​ Locator s are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, lo...
  • Writing tests: - Getting Started Writing tests On this page # Writing tests ## Introduction ​ Playwright tests are simple: they perform actions and assert the state against...

Workflow

  1. Start with the reference file that matches the question.
  2. Prefer the most relevant file under docs/ for exact instructions and prose guidance.
  3. Use schemas/ and examples/ for exact contracts, payloads, manifests, requests, and snippets.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical Sources