1- Playwright Execution using NodeJS API
Here's an example of how to can create a Playwright execution microservice using the Node.js API:
https://github.com/asadzakir/playwright-execution-api
Here's how the microservice works:
The microservice uses the Express.js framework to create a web server.
It defines a single endpoint
/api/pw/exe
that accepts a POST request with aplaywright_test_steps
property in the request body.Inside the
/api/pw/exe
endpoint, the microservice:Launches a new Chromium browser instance using
chromium.launch()
.Creates a new browser context using
context.newPage()
.Executes the provided Playwright script using the
eval()
function.Closes the browser instance using
browser.close()
.
API Endpoint
http://localhost:5000/api/pw/exe
...
2- Playwright Local Execution with in GTP Recorder using the playwright CRX library
here's another way to execute Playwright scripts locally using the Playwright CRX library with in the GTP Recorder:
Install the Playwright CRX library:
Run the following command to install the Playwright CRX library:
Code Block npm install @playwright/crx
...