curl --request POST \
--url https://api.webcompute.dev/v1/browsers/{id}/playwright/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"pageId": {},
"timeoutMs": 30000,
"capture": false,
"variables": {},
"variableScopes": {}
}
'import requests
url = "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute"
payload = {
"code": "<string>",
"pageId": {},
"timeoutMs": 30000,
"capture": False,
"variables": {},
"variableScopes": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
pageId: {},
timeoutMs: 30000,
capture: false,
variables: {},
variableScopes: {}
})
};
fetch('https://api.webcompute.dev/v1/browsers/{id}/playwright/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'pageId' => [
],
'timeoutMs' => 30000,
'capture' => false,
'variables' => [
],
'variableScopes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.webcompute.dev/v1/browsers/{id}/playwright/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.webcompute.dev/v1/browsers/{id}/playwright/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}"
response = http.request(request)
puts response.read_bodyExecute browser-control code
Runs the current Playwright-backed browser-control API against a ready managed browser. Use this when deterministic browser control is the right tool.
curl --request POST \
--url https://api.webcompute.dev/v1/browsers/{id}/playwright/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"pageId": {},
"timeoutMs": 30000,
"capture": false,
"variables": {},
"variableScopes": {}
}
'import requests
url = "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute"
payload = {
"code": "<string>",
"pageId": {},
"timeoutMs": 30000,
"capture": False,
"variables": {},
"variableScopes": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
pageId: {},
timeoutMs: 30000,
capture: false,
variables: {},
variableScopes: {}
})
};
fetch('https://api.webcompute.dev/v1/browsers/{id}/playwright/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'pageId' => [
],
'timeoutMs' => 30000,
'capture' => false,
'variables' => [
],
'variableScopes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.webcompute.dev/v1/browsers/{id}/playwright/execute"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.webcompute.dev/v1/browsers/{id}/playwright/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.webcompute.dev/v1/browsers/{id}/playwright/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"pageId\": {},\n \"timeoutMs\": 30000,\n \"capture\": false,\n \"variables\": {},\n \"variableScopes\": {}\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Top-level async Playwright code body. page, context, browser, files, and artifacts are in scope. Maximum 262144 UTF-8 bytes.
Optional canonical page id such as page_tab-1.
Execution timeout in milliseconds.
1 <= x <= 120000Set false to disable all automatic post-step capture, or pass an object to customize screenshot, status, observation, and activity capture.
false Bounded string variables made available to Playwright code through the variables global. Runtime validation enforces the UTF-8 byte limit.
Show child attributes
Show child attributes
Bounded variable scope metadata for provided or policy-only variables.
Show child attributes
Show child attributes
Response
Browser-control execution completed.