Passez une liste de commandes avec l’URL. Le navigateur exécute chaque étape avant la capture. Utilisez sleep pour les redirections JS et navigate pour la page protégée.
curl -X POST https://api.screenshotcenter.com/v1/screenshot \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://app.example.com/login",
"steps": [
{"command": "type", "element": "#email", "value": "user@example.com"},
{"command": "type", "element": "#password", "value": "your-password"},
{"command": "click", "element": "#login-button"},
{"command": "sleep", "value": "3"},
{"command": "navigate", "value": "https://app.example.com/dashboard"},
{"command": "sleep", "value": "2"},
{"command": "screenshot"}
],
"size": "page",
"format": "png"
}'
import { ScreenshotCenterClient } from 'screenshotcenter';
const client = new ScreenshotCenterClient({ apiKey: 'YOUR_API_KEY' });
const screenshot = await client.screenshot.create({
url: 'https://app.example.com/login',
steps: [
{ command: 'type', element: '#email', value: 'user@example.com' },
{ command: 'type', element: '#password', value: 'your-password' },
{ command: 'click', element: '#login-button' },
{ command: 'sleep', value: '3' },
{ command: 'navigate', value: 'https://app.example.com/dashboard' },
{ command: 'sleep', value: '2' },
{ command: 'screenshot' },
],
size: 'page',
});
const result = await client.waitFor(screenshot.id);
await client.screenshot.saveImage(result.id, './dashboard.png');
from screenshotcenter import ScreenshotCenterClient
client = ScreenshotCenterClient(api_key="YOUR_API_KEY")
shot = client.screenshot.create(
url="https://app.example.com/login",
steps=[
{"command": "type", "element": "#email", "value": "user@example.com"},
{"command": "type", "element": "#password", "value": "your-password"},
{"command": "click", "element": "#login-button"},
{"command": "sleep", "value": "3"},
{"command": "navigate", "value": "https://app.example.com/dashboard"},
{"command": "sleep", "value": "2"},
{"command": "screenshot"},
],
size="page",
)
result = client.wait_for(shot["id"])
client.screenshot.save_image(result["id"], "dashboard.png")
use ScreenshotCenter\Client;
$client = new Client(getenv('SCREENSHOTCENTER_API_KEY'));
$shot = $client->screenshot->create('https://app.example.com/login', [
'steps' => [
['command' => 'type', 'element' => '#email', 'value' => 'user@example.com'],
['command' => 'type', 'element' => '#password', 'value' => 'your-password'],
['command' => 'click', 'element' => '#login-button'],
['command' => 'sleep', 'value' => '3'],
['command' => 'navigate', 'value' => 'https://app.example.com/dashboard'],
['command' => 'sleep', 'value' => '2'],
['command' => 'screenshot'],
],
'size' => 'page',
]);
$result = $client->waitFor($shot['id']);
$client->screenshot->saveImage($result['id'], './dashboard.png');
import sc "github.com/juliensobrier/screenshotcenter-go"
client := sc.New("YOUR_API_KEY")
shot, _ := client.Screenshot.Create("https://app.example.com/login", &sc.CreateParams{
Steps: []sc.Step{
{Command: "type", Element: "#email", Value: "user@example.com"},
{Command: "type", Element: "#password", Value: "your-password"},
{Command: "click", Element: "#login-button"},
{Command: "sleep", Value: "3"},
{Command: "navigate", Value: "https://app.example.com/dashboard"},
{Command: "sleep", Value: "2"},
{Command: "screenshot"},
},
Size: "page",
})
result, _ := client.WaitFor(shot.ID, nil)
client.Screenshot.SaveImage(result.ID, "./dashboard.png", nil)
require "screenshotcenter"
client = ScreenshotCenter::Client.new(ENV["SCREENSHOTCENTER_API_KEY"])
shot = client.screenshot.create("https://app.example.com/login",
steps: [
{ command: "type", element: "#email", value: "user@example.com" },
{ command: "type", element: "#password", value: "your-password" },
{ command: "click", element: "#login-button" },
{ command: "sleep", value: "3" },
{ command: "navigate", value: "https://app.example.com/dashboard" },
{ command: "sleep", value: "2" },
{ command: "screenshot" },
],
size: "page"
)
result = client.wait_for(shot["id"])
client.screenshot.save_image(result["id"], "./dashboard.png")
import io.screenshotcenter.ScreenshotCenterClient;
import io.screenshotcenter.models.*;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
var client = new ScreenshotCenterClient("YOUR_API_KEY");
var params = new ScreenshotParams()
.url("https://app.example.com/login")
.steps(List.of(
new Step("type", "#email", "user@example.com"),
new Step("type", "#password", "your-password"),
new Step("click", "#login-button", null),
new Step("sleep", null, "3"),
new Step("navigate", null, "https://app.example.com/dashboard"),
new Step("sleep", null, "2"),
new Step("screenshot")
))
.size("page");
var shot = client.screenshot().create(params);
var result = client.waitFor(shot.getId());
client.screenshot().saveImage(result.getId(), "./dashboard.png");
}
}
using ScreenshotCenter;
var client = new ScreenshotCenterClient("YOUR_API_KEY");
var shot = await client.Screenshot.CreateAsync(new ScreenshotParams {
Url = "https://app.example.com/login",
Steps = new[] {
new Step { Command = "type", Element = "#email", Value = "user@example.com" },
new Step { Command = "type", Element = "#password", Value = "your-password" },
new Step { Command = "click", Element = "#login-button" },
new Step { Command = "sleep", Value = "3" },
new Step { Command = "navigate", Value = "https://app.example.com/dashboard" },
new Step { Command = "sleep", Value = "2" },
new Step { Command = "screenshot" },
},
Size = "page",
});
var result = await client.WaitForAsync(shot.Id);
await client.Screenshot.SaveImageAsync(result.Id, "./dashboard.png");