AI-powered React debugging with Playwright and MCP
View the Project on GitHub Lars-Albinsson/playwright-react-debug-mcp
Tools for controlling the browser and interacting with page elements.
Navigate to a URL with configurable wait conditions.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | URL to navigate to |
waitUntil |
string | No | Wait condition: load, domcontentloaded, networkidle |
Example:
Navigate to https://example.com/dashboard and wait for network idle
Click on an element. Supports various click types and buttons.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | Yes | Element selector |
button |
string | No | left, right, middle (default: left) |
clickCount |
number | No | Number of clicks (default: 1, use 2 for double-click) |
Example:
Click the submit button
Double-click on the file to open it
Right-click on the image to see context menu
Clear a form field and fill it with text.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | Yes | Input element selector |
value |
string | Yes | Text to fill |
Example:
Fill the email field with test@example.com
Select options in a dropdown. Supports single and multiple selection.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | Yes | Select element selector |
values |
string[] | Yes | Values to select |
Example:
Select "California" from the state dropdown
Select multiple options: "Red", "Blue", "Green"
Type text character by character. Useful for autocomplete fields or simulating real user input.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | Yes | Input element selector |
text |
string | Yes | Text to type |
delay |
number | No | Delay between keystrokes in ms (default: 50) |
Example:
Type "react hooks" into the search box slowly to trigger autocomplete
Hover over an element. Useful for triggering hover states, tooltips, or dropdown menus.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | Yes | Element selector |
Example:
Hover over the user menu to show the dropdown
Scroll the page or scroll an element into view.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | No | Element to scroll into view |
direction |
string | No | up, down, left, right |
amount |
number | No | Pixels to scroll |
Example:
Scroll down 500 pixels
Scroll the footer into view
Wait for an element to reach a specific state, or wait for navigation.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
selector |
string | No | Element selector (for element waiting) |
state |
string | No | visible, hidden, attached, detached |
navigation |
boolean | No | Wait for navigation event |
timeout |
number | No | Maximum wait time in ms (default: 30000) |
Example:
Wait for the loading spinner to disappear
Wait for the modal to become visible
Wait for navigation after form submission
Navigate back in browser history.
Parameters: None
Example:
Go back to the previous page
Navigate forward in browser history.
Parameters: None
Example:
Go forward in history
Reload the current page.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
waitUntil |
string | No | Wait condition after reload |
Example:
Reload the page and wait for network idle
# By ID
#login-button
# By class
.btn-primary
# By attribute
[data-testid="submit"]
input[type="email"]
# Combining
form#login .submit-btn
# Exact match
text=Submit
# Case-insensitive regex
text=/sign in/i
# Partial match
text=Sign
role=button[name="Submit"]
role=textbox[name="Email"]
role=link[name="Home"]
Fill the email field with test@example.com
Fill the password field with secret123
Click the login button
Wait for navigation
Type "react" slowly into the search box
Wait for the suggestions dropdown to appear
Click the first suggestion
Hover over the user menu
Wait for the dropdown to be visible
Click "Sign Out"