Enabling Testing Capability
To use test assertion tools, start the MCP server with the testing capability:Element Visibility Assertions
browser_verify_element_visible
Verify that an element is visible on the page.ROLE of the element. Can be found in the snapshot like this:
- {ROLE} "Accessible Name":Common roles: button, link, textbox, heading, img, list, etc.ACCESSIBLE_NAME of the element. Can be found in the snapshot like this:
- role "{ACCESSIBLE_NAME}"browser_verify_text_visible
Verify that specific text is visible on the page. Preferbrowser_verify_element_visible when possible.
TEXT to verify. Can be found in the snapshot like this:
- role "Accessible Name": {TEXT} or like this: - text: {TEXT}browser_verify_text_visible searches for the text anywhere on the page. Use browser_verify_element_visible for more precise assertions.List Verification
browser_verify_list_visible
Verify that a list with specific items is visible on the page.Human-readable list description
Exact target element reference that points to the list
Items to verify in the list. Each item should be a string.
Value Verification
browser_verify_value
Verify the value of a form element.Type of the element. Examples:
textbox, checkbox, radio, selectHuman-readable element description
Exact target element reference that points to the element
Value to verify. For checkbox, use “true” or “false”.
Locator Generation
browser_generate_locator
Generate a Playwright locator for an element to use in tests.Human-readable element description used to obtain permission to interact with the element
Exact target element reference from the page snapshot
Testing Workflows
Form Validation Testing
Verify form behavior and validation:UI Component Testing
Verify UI components display correctly:E2E Testing Workflow
Complete end-to-end testing scenario:Best Practices
Use Snapshots for Element Discovery
Use Snapshots for Element Discovery
Always use
browser_snapshot before assertions to identify the correct roles, accessible names, and refs for elements.Prefer Semantic Assertions
Prefer Semantic Assertions
Use
browser_verify_element_visible instead of browser_verify_text_visible when possible for more robust tests.Wait for Dynamic Content
Wait for Dynamic Content
Use
browser_wait_for before assertions if content loads dynamically:Handle Assertion Failures
Handle Assertion Failures
Assertion tools will fail if the expected state doesn’t match. Use this for test validation and error reporting.
Generate Locators for Test Code
Generate Locators for Test Code
Use
browser_generate_locator to get Playwright locators that you can use in your test scripts for consistency.Assertion vs. Wait
Assertions (
browser_verify_*) fail immediately if the condition isn’t met. If you need to wait for an element to appear, use browser_wait_for first, then verify with assertions.Common Testing Patterns
Verify Form Submission Flow
Verify Navigation Flow
Related Tools
Page Snapshot
Capture page structure to identify elements for assertions
Wait For
Wait for conditions before asserting
Core Automation
Interact with pages before verifying results

