Execute custom JavaScript or TypeScript code during your test flow.
execute javascript
interaction step allows you to execute arbitrary JavaScript or TypeScript code as part of your test flow.
This is useful for performing custom logic, calculations, or interacting with APIs that are not directly accessible through other test steps.
'execute javascript' interaction option in a test step, 05/2025
execute javascript
step fails.
'execute javascript' interaction option executed in browser context, 07/2025
stdout
using console.log
. These variables can be used in subsequent steps of your test.
For example, if your script creates a new document in your application and receives a document ID in the response, you can expose this ID as a dynamic variable:
$$documentId
.
Example: Exporting a dynamic variable from a JavaScript step
execute javascript
step, you can extend your tests with custom logic while maintaining security and reproducibility.