Back to all steps
Execute JS and send result
Step fields
1
selector
(text)
2
webhook endpoint
(webhook)
In a scenario, fields are joined with
|.Run a JS snippet and send its result to a webhook. Format: js|endpoint.
Example: document.title.
The endpoint is picked from your webhooks (Profile → API tokens → Webhooks) - the address is no longer typed into the step. The server sends it: the request is signed, retried if the endpoint is down, and every delivery shows up in the webhook log. The step never fails the test.
Example: document.title.
The endpoint is picked from your webhooks (Profile → API tokens → Webhooks) - the address is no longer typed into the step. The server sends it: the request is signed, retried if the endpoint is down, and every delivery shows up in the webhook log. The step never fails the test.
Usage example
Run JS and send the result via a POST request.
Format: js|url
Examples:
document.title|https://myapi.com/titlesdocument.querySelectorAll(".product").length|https://myapi.com/counts
POST request: the JS result arrives in the html field (cast to a string).
Receiving example (PHP): $_POST["html"]