AWS WAF and other CAPTCHAs
Vision Engine tasks for sliders and rotations
Slider and rotation puzzles ask for a movement rather than text or a token. A Vision Engine task measures that movement from the puzzle images, at $1.05 per 1,000, and your browser script performs it.
What Vision Engine does
A slider CAPTCHA shows a background picture with a missing piece and asks you to drag the piece into the gap. A rotation puzzle shows a tilted image and asks you to turn it upright. In both cases the hard part is measuring: how many pixels to slide, or how many degrees to turn. A VisionEngine task takes the puzzle images and returns that number. Moving the handle is left to your automation, which keeps the task generic across many widget designs.
Vision Engine is for custom or vendor widgets that do not have their own task type. For DataDome's slider use the dedicated DataDome slider task, which returns a cookie; for GeeTest use the GeeTest task, which returns the values GeeTest expects.
Task inputs and outputs
| Field | Required | Content |
|---|---|---|
| type | Yes | VisionEngine |
| module | Yes | The puzzle kind, for example slider_1 or rotate_1 |
| image | Yes | Base64 of the challenge image |
| imageBackground | No | Base64 of the background image, when the widget delivers it separately |
For a slider module the solution looks like {"distance": 128}: the number of pixels to move the piece, measured on the image you sent. Rotation modules return an angle value instead. Read the solution generically, as the code further down does, so one helper handles both.
Choosing the images to send
Widgets deliver their pictures in different ways, and the right inputs follow from that:
- Piece and background as two images. Send the piece (or the composite challenge) as
imageand the background with the gap asimageBackground. This is the most common slider layout. - One composite image. Send it as
imageand leave the background out. - Rotation. Send the rotated picture as
image. Add a background only if the widget draws the rotating part on top of a separate one.
Prefer the original image files over screenshots when you can reach them: open DevTools, find the img elements or the CSS background URLs of the puzzle, and fetch those bytes inside the page. If the widget draws onto a canvas, a canvas toDataURL or an element screenshot works too.
Solving and dragging in Playwright
The example below uses Playwright for Node.js. It reads both images from the page, asks for the distance, scales it to the displayed size and drags the handle with small steps.
const { chromium } = await import('playwright');
const VE_URL = 'https://gatesolver.com';
const veKey = process.env.VISION_KEY ?? 'YOUR_API_KEY';
async function visionMeasure(module, image, imageBackground) {
const sendJson = { 'Content-Type': 'application/json' };
const call = async (m, b) => (await fetch(`${VE_URL}/${m}`,
{ method: 'POST', headers: sendJson, body: JSON.stringify({ clientKey: veKey, ...b }) })).json();
const task = { type: 'VisionEngine', module, image };
if (imageBackground) task.imageBackground = imageBackground;
const born = await call('createTask', { task });
if (born.errorId) {
throw new Error(`VisionEngine task refused with ${born.errorCode}`);
}
for (let i = 0; i < 60; i++) {
await new Promise((wake) => { setTimeout(wake, 1000); });
const res = await call('getTaskResult', { taskId: born.taskId });
if (res.errorId || res.status === 'failed') throw new Error(res.errorCode ?? 'failed');
if (res.status === 'ready') return res.solution;
}
throw new Error('vision task timed out');
}
const imgB64 = (page, css) => page.$eval(css, async (el) => {
const buf = await (await fetch(el.src)).arrayBuffer();
let bin = '';
new Uint8Array(buf).forEach((b) => { bin += String.fromCharCode(b); });
return btoa(bin);
});
The helper imgB64 fetches the image inside the page, so cookies and the page's origin rules apply, and returns plain base64 with no data URI prefix.
Scale the distance, then drag
The distance refers to the image's natural width. If the page shows the image smaller or larger than that, multiply by the ratio between displayed and natural width before you move the mouse.
const chrome = await chromium.launch();
const page = await chrome.newPage({ viewport: { width: 1280, height: 800 } });
await page.goto('https://login.example.net/verify');
const piece = await imgB64(page, '.puzzle-piece img');
const back = await imgB64(page, '.puzzle-bg img');
const answer = await visionMeasure('slider_1', piece, back);
const ratio = await page.$eval('.puzzle-bg img', (el) => el.clientWidth / el.naturalWidth);
const handle = await page.locator('.slider-handle').boundingBox();
const startX = handle.x + handle.width / 2;
const startY = handle.y + handle.height / 2;
await page.mouse.move(startX, startY);
await page.mouse.down();
await page.mouse.move(startX + answer.distance * ratio, startY + 2, { steps: 25 });
await page.waitForTimeout(150);
await page.mouse.up();
The steps option makes Playwright send intermediate mouse moves instead of a single jump, which many widgets require before they accept a drag. A tiny vertical offset and a short pause before releasing also look like a hand on a mouse. The selectors are placeholders; read the real ones from the widget you test.
Rotation puzzles
For a rotate_1 style module, the solution carries an angle. How you apply it depends on the widget: some rotate the picture while you drag a slider along a track, others rotate it as you drag in a circle. For the track style, work out how many pixels of track equal one degree (track width divided by 360 is common, but confirm by testing) and drag that far. Read the answer defensively so the same code handles both kinds:
const amount = answer.distance ?? answer.angle;
if (typeof amount !== 'number') throw new Error(`unexpected solution ${JSON.stringify(answer)}`);
Pacing and repeat attempts
Most slider widgets allow a few attempts before they swap in a new picture or lock the form for a while. Treat every attempt as fresh: capture the images again, create a new task and drag once. Spacing attempts a couple of seconds apart, and keeping the whole drag between half a second and a second and a half, matches how people use these widgets and avoids tripping timing checks that some vendors run on the drag itself.
Checking the result
Most widgets show a success state (a tick, a green border, or the widget closing) and then set a token or continue the form. Wait for that state with a locator rather than a fixed sleep. If the piece lands a few pixels off, the usual cause is scaling: compare the natural and displayed widths again, and check whether the track starts a few pixels to the right of the image edge, in which case add that offset.
Troubleshooting
- Consistent offset: the widget measures from a different origin. Add the constant difference after a few test runs.
- Drag ignored: the widget listens for pointer or touch events. Try smaller steps or dispatch the events on the handle element.
- ERROR_INVALID_TASK_DATA: the module name is missing or an image field is empty or still has a data URI prefix.
- New puzzle after each try: normal. Capture again for every attempt; each answer belongs to one picture.
The Vision Engine page lists the current price and modules, and the Playwright integration shows browser setup in more detail.
Common questions
What does the distance in a VisionEngine solution mean?
The number of pixels to move the piece, measured on the image you sent. Scale it if the page displays the image at a different size.
When should I send imageBackground?
When the widget delivers the piece and the background as separate images. For a single composite image leave it out.
Which module do I use for a rotation puzzle?
A rotate module such as rotate_1. Its solution returns an angle instead of a distance.
Can Vision Engine solve the DataDome slider?
Use the DatadomeSliderTask for DataDome, because the site expects a cookie, not a drag measured in pixels.
Why does the widget reject a correct distance?
Usually a scaling or offset issue, or a drag made in one jump. Scale to the displayed size and move in small steps.
Keep reading
- Vision Engine solver$1.05 per 1,000 tasks, answers under 1 seconds.
- Slider CAPTCHADrag-the-piece puzzles: what they measure beyond the final offset, who serves them, and how a solver works them out.
- Solve the DataDome sliderBuild the captcha URL from the DataDome block page, solve it through your own proxy and keep IP and User-Agent identical afterwards.
- PlaywrightPlaywright in Node.js and Python: read widget keys from the DOM or network, inject tokens, and add answers through route interception.