mcp-playwright

mcp-playwright

4.5

mcp-playwright is hosted online, so all tools can be tested directly either in theInspector tabor in theOnline Client.

If you are the rightful owner of mcp-playwright and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol server that provides browser automation capabilities using Playwright.

start_codegen_session

Start a new code generation session to record Playwright actions

Try it

Code generation options

Directory path where generated tests will be saved (use absolute path)

    Prefix to use for generated test names (default: 'GeneratedTest')

      Whether to include descriptive comments in generated tests

      Whether to include descriptive comments in generated tests

            Result:

            end_codegen_session

            End a code generation session and generate the test file

            Try it

            ID of the session to end

                Result:

                get_codegen_session

                Get information about a code generation session

                Try it

                ID of the session to retrieve

                    Result:

                    clear_codegen_session

                    Clear a code generation session without generating a test

                    Try it

                    ID of the session to clear

                        Result:

                        playwright_navigate

                        Navigate to a URL

                        Try it

                        URL to navigate to the website specified

                          Browser type to use (chromium, firefox, webkit). Defaults to chromium

                            Viewport width in pixels (default: 1280)

                              Viewport height in pixels (default: 720)

                                Navigation timeout in milliseconds

                                  Navigation wait condition

                                    Run browser in headless mode (default: false)

                                    Run browser in headless mode (default: false)

                                        Result:

                                        playwright_screenshot

                                        Take a screenshot of the current page or a specific element

                                        Try it

                                        Name for the screenshot

                                          CSS selector for element to screenshot

                                            Width in pixels (default: 800)

                                              Height in pixels (default: 600)

                                                Store screenshot in base64 format (default: true)

                                                Store screenshot in base64 format (default: true)

                                                  Store screenshot of the entire page (default: false)

                                                  Store screenshot of the entire page (default: false)

                                                    Save screenshot as PNG file (default: false)

                                                    Save screenshot as PNG file (default: false)

                                                      Custom downloads directory path (default: user's Downloads folder)

                                                          Result:

                                                          playwright_click

                                                          Click an element on the page

                                                          Try it

                                                          CSS selector for the element to click

                                                              Result:

                                                              playwright_iframe_click

                                                              Click an element in an iframe on the page

                                                              Try it

                                                              CSS selector for the iframe containing the element to click

                                                                CSS selector for the element to click

                                                                    Result:

                                                                    playwright_iframe_fill

                                                                    Fill an element in an iframe on the page

                                                                    Try it

                                                                    CSS selector for the iframe containing the element to fill

                                                                      CSS selector for the element to fill

                                                                        Value to fill

                                                                            Result:

                                                                            playwright_fill

                                                                            fill out an input field

                                                                            Try it

                                                                            CSS selector for input field

                                                                              Value to fill

                                                                                  Result:

                                                                                  playwright_select

                                                                                  Select an element on the page with Select tag

                                                                                  Try it

                                                                                  CSS selector for element to select

                                                                                    Value to select

                                                                                        Result:

                                                                                        playwright_hover

                                                                                        Hover an element on the page

                                                                                        Try it

                                                                                        CSS selector for element to hover

                                                                                            Result:

                                                                                            playwright_upload_file

                                                                                            Upload a file to an input[type='file'] element on the page

                                                                                            Try it

                                                                                            CSS selector for the file input element

                                                                                              Absolute path to the file to upload

                                                                                                  Result:

                                                                                                  playwright_evaluate

                                                                                                  Execute JavaScript in the browser console

                                                                                                  Try it

                                                                                                  JavaScript code to execute

                                                                                                      Result:

                                                                                                      playwright_console_logs

                                                                                                      Retrieve console logs from the browser with filtering options

                                                                                                      Try it

                                                                                                      Type of logs to retrieve (all, error, warning, log, info, debug, exception)

                                                                                                        Text to search for in logs (handles text with square brackets)

                                                                                                          Maximum number of logs to return

                                                                                                            Whether to clear logs after retrieval (default: false)

                                                                                                            Whether to clear logs after retrieval (default: false)

                                                                                                                Result:

                                                                                                                playwright_close

                                                                                                                Close the browser and release all resources

                                                                                                                Try it

                                                                                                                  Result:

                                                                                                                  playwright_get

                                                                                                                  Perform an HTTP GET request

                                                                                                                  Try it

                                                                                                                  URL to perform GET operation

                                                                                                                      Result:

                                                                                                                      playwright_post

                                                                                                                      Perform an HTTP POST request

                                                                                                                      Try it

                                                                                                                      URL to perform POST operation

                                                                                                                        Data to post in the body

                                                                                                                          Bearer token for authorization

                                                                                                                            Additional headers to include in the request

                                                                                                                                Result:

                                                                                                                                playwright_put

                                                                                                                                Perform an HTTP PUT request

                                                                                                                                Try it

                                                                                                                                URL to perform PUT operation

                                                                                                                                  Data to PUT in the body

                                                                                                                                      Result:

                                                                                                                                      playwright_patch

                                                                                                                                      Perform an HTTP PATCH request

                                                                                                                                      Try it

                                                                                                                                      URL to perform PUT operation

                                                                                                                                        Data to PATCH in the body

                                                                                                                                            Result:

                                                                                                                                            playwright_delete

                                                                                                                                            Perform an HTTP DELETE request

                                                                                                                                            Try it

                                                                                                                                            URL to perform DELETE operation

                                                                                                                                                Result:

                                                                                                                                                playwright_expect_response

                                                                                                                                                Ask Playwright to start waiting for a HTTP response. This tool initiates the wait operation but does not wait for its completion.

                                                                                                                                                Try it

                                                                                                                                                Unique & arbitrary identifier to be used for retrieving this response later with `Playwright_assert_response`.

                                                                                                                                                  URL pattern to match in the response.

                                                                                                                                                      Result:

                                                                                                                                                      playwright_assert_response

                                                                                                                                                      Wait for and validate a previously initiated HTTP response wait operation.

                                                                                                                                                      Try it

                                                                                                                                                      Identifier of the HTTP response initially expected using `Playwright_expect_response`.

                                                                                                                                                        Data to expect in the body of the HTTP response. If provided, the assertion will fail if this value is not found in the response body.

                                                                                                                                                            Result:

                                                                                                                                                            playwright_custom_user_agent

                                                                                                                                                            Set a custom User Agent for the browser

                                                                                                                                                            Try it

                                                                                                                                                            Custom User Agent for the Playwright browser instance

                                                                                                                                                                Result:

                                                                                                                                                                playwright_get_visible_text

                                                                                                                                                                Get the visible text content of the current page

                                                                                                                                                                Try it

                                                                                                                                                                  Result:

                                                                                                                                                                  playwright_get_visible_html

                                                                                                                                                                  Get the HTML content of the current page. By default, all <script> tags are removed from the output unless removeScripts is explicitly set to false.

                                                                                                                                                                  Try it

                                                                                                                                                                  CSS selector to limit the HTML to a specific container

                                                                                                                                                                    Remove all script tags from the HTML (default: true)

                                                                                                                                                                    Remove all script tags from the HTML (default: true)

                                                                                                                                                                      Remove all HTML comments (default: false)

                                                                                                                                                                      Remove all HTML comments (default: false)

                                                                                                                                                                        Remove all style tags from the HTML (default: false)

                                                                                                                                                                        Remove all style tags from the HTML (default: false)

                                                                                                                                                                          Remove all meta tags from the HTML (default: false)

                                                                                                                                                                          Remove all meta tags from the HTML (default: false)

                                                                                                                                                                            Perform comprehensive HTML cleaning (default: false)

                                                                                                                                                                            Perform comprehensive HTML cleaning (default: false)

                                                                                                                                                                              Minify the HTML output (default: false)

                                                                                                                                                                              Minify the HTML output (default: false)

                                                                                                                                                                                Maximum number of characters to return (default: 20000)

                                                                                                                                                                                    Result:

                                                                                                                                                                                    playwright_go_back

                                                                                                                                                                                    Navigate back in browser history

                                                                                                                                                                                    Try it

                                                                                                                                                                                      Result:

                                                                                                                                                                                      playwright_go_forward

                                                                                                                                                                                      Navigate forward in browser history

                                                                                                                                                                                      Try it

                                                                                                                                                                                        Result:

                                                                                                                                                                                        playwright_drag

                                                                                                                                                                                        Drag an element to a target location

                                                                                                                                                                                        Try it

                                                                                                                                                                                        CSS selector for the element to drag

                                                                                                                                                                                          CSS selector for the target location

                                                                                                                                                                                              Result:

                                                                                                                                                                                              playwright_press_key

                                                                                                                                                                                              Press a keyboard key

                                                                                                                                                                                              Try it

                                                                                                                                                                                              Key to press (e.g. 'Enter', 'ArrowDown', 'a')

                                                                                                                                                                                                Optional CSS selector to focus before pressing key

                                                                                                                                                                                                    Result:

                                                                                                                                                                                                    playwright_save_as_pdf

                                                                                                                                                                                                    Save the current page as a PDF file

                                                                                                                                                                                                    Try it

                                                                                                                                                                                                    Directory path where PDF will be saved

                                                                                                                                                                                                      Name of the PDF file (default: page.pdf)

                                                                                                                                                                                                        Page format (e.g. 'A4', 'Letter')

                                                                                                                                                                                                          Whether to print background graphics

                                                                                                                                                                                                          Whether to print background graphics

                                                                                                                                                                                                            Page margins

                                                                                                                                                                                                                        Result:

                                                                                                                                                                                                                        playwright_click_and_switch_tab

                                                                                                                                                                                                                        Click a link and switch to the newly opened tab

                                                                                                                                                                                                                        Try it

                                                                                                                                                                                                                        CSS selector for the link to click

                                                                                                                                                                                                                            Result: