Install Playwright Browser
Purpose
This document describes the options to host a Playwright Browser, which is required to run a Frontend Test with MTA.
When executing a Frontend test, Playwright starts and hosts its own Browser. This can be Chromium, Firefox or Webkit. In order to do this, Playwright needs to load required dependencies and, therefore, it needs the right permissions on the host server.
Currently, there are 3 supported options to host a Playwright Browser:
- From within the Mendix project (local only)
- From BrowserStack (cloud only)
- From a Docker Container (cloud or local)
Option 1 is only available for a local machine, because Mendix does not allow for third party frameworks, like Playwright, to load its own dependencies. It is required to host the Playwright Browser elsewhere in the cloud when running the Mendix App in the cloud.
Prerequisites
- Make sure that the MTA Plugin module is imported and configured.
- Start by importing the Playwright Connector.
- Then import the Frontend Test Kit to start testing the most common Mendix Widgets.
- Add both the Module Roles to the project's User Role(s) that will be used to execute Frontend Tests.
Run Playwright Locally
Playwright can be hosted locally with the Mendix App running in Studio Pro (e.g. localhost). For this, you only need to add the necessary driver-bundle.jar file to the /userlib folder of the Mendix project.
The currently supported version is 1.53.0. Download it here:
https://repo1.maven.org/maven2/com/microsoft/playwright/driver-bundle/1.53.0/driver-bundle-1.53.0.jar
It may be necessary to restart your computer if you want to use a locally-hosted Playwright Browser for the first time.
If this jar file is added to the Mendix project and the app is deployed to a local server that allows Playwright to load the dependencies it needs, this is sufficient for executing the Test Cases. Separate hosting of the Playwright browsers is not needed then. However, if the jar-file is not added and/or the local server is also limited in the access it requires for Playwright to load its dependencies, it is needed to host a Playwright server elsewhere.
Run Playwright in Browserstack
One alternative option to hosting Playwright locally is to use Browserstack. BrowserStack is a cloud-based testing platform that enables developers and QA teams to test applications across various browsers and devices. It offers native support for Playwright, allowing users to run automated end-to-end tests on real devices and browsers within its cloud infrastructure.
Currently, using Browserstack is only supported if the Mendix App is running in the cloud. Local Testing is currently only supported if Playwright is also running locally. Local Testing with Browserstack will be supported in a future release of the Playwright Connector.
Run Playwright in a Docker container
This chapter describes the situation where the Test Application is started from Studio Pro, and Docker Desktop is running on the same machine. When running the Test Application in the cloud, the URL in the Navigate action in step 19 will be replaced by the Application URL in the cloud. When running Docker in the cloud, omit the steps to install Docker Desktop, and replace the command in step 9 by the one noted in https://playwright.dev/docs/docker#running-the-playwright-server.
- Install Docker Desktop https://www.docker.com/products/docker-desktop/.
- Although not always required by Docker, restart Windows.
- Start Studio Pro that will run the Test Application and connect to MTA.
- Make sure the Connector and Mendix Frontend Testkit are imported.
- Check the playwright version that is being used by the Connector. This should be noted in the documentation in the Mendix Marketplace.
- Run the Test Application. Check MTA to see if it's connected.
- Run Docker Desktop. No need to sign-in, just click Skip.
- Run a command line prompt (cmd).
- Copy the command line noted here into a text editor (use the copy button): https://playwright.dev/docs/docker#network-configuration.
- Replace the two parts where the playwright version is denoted, by the playwright version in use by the Connector. Example:
docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.53.0-noble /bin/sh -c "npx -y playwright@1.53.0 run-server --port 3000 --host 0.0.0.0" - Copy and paste the command line in the prompt and press Enter.
This will do three things:
1. download the docker image containing the playwright server
2. run this image in a virtualized Docker container
3. make sure that the hostmachine can be reached from the container. - Wait until it says
Listening on ws://0.0.0.0:3000/in the prompt. - To shutdown the locally running docker container simply press Ctrl+C in the prompt.
You cannot navigate to localhost, because the localhost will point to inside the virtualized container. You have to navigate to http://hostmachine:8080 (assuming the Test Application is running on port 8080). This will only work if you correctly executed step 10.
Feedback?
Missing anything? Let us know!
Last updated 15 September 2025