Information Security 9 min read

Bypassing Geetest Slider Captcha Using Selenium WebDriver

This article demonstrates how to use Selenium WebDriver with JavaScript to automate the Geetest slider captcha, covering the captcha background, WebDriver setup, element interaction, image capture, pixel analysis, and crafting human‑like sliding trajectories to attempt bypassing the security check.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Bypassing Geetest Slider Captcha Using Selenium WebDriver

The article begins by explaining that modern AI can easily solve distorted image captchas, making them unreliable, while slider captchas like Geetest offer better security and user experience.

It introduces the concept of CAPTCHAs as a Turing test and lists common types, emphasizing the rise of slider captchas due to their difficulty for machines.

With the recent release of the W3C WebDriver standard, the author shows how to use Selenium WebDriver to automate the Geetest slider captcha.

WebDriver Installation

Firefox is chosen as the browser, and the appropriate driver can be downloaded from the official repository.

const webdriver = require('selenium-webdriver');

async function() { let driver = await new webdriver.Builder().forBrowser('firefox').build(); await driver.get('http://www.geetest.com/type/'); console.log('success'); }();

The script opens the Geetest demo page and verifies the browser is under control.

Step 1: Open Geetest Demo Page

await driver.findElement(webdriver.By.css('.products-content li:nth-child(2)')).click();

Step 2: Select Slider Verification

await driver.findElement(webdriver.By.css('.geetest_radar_tip')).click();

Step 3: Capture the Background Image

To locate the missing puzzle piece, the script hides the full background canvas and captures the puzzle background canvas.

await driver.executeScript(`document.querySelector('.geetest_canvas_fullbg').style.display = 'none'`); const bgCanvas = await driver.findElement(webdriver.By.css('.geetest_canvas_bg')); // Obtain base64 PNG screenshot here

Since the missing area appears darker, the author uses a simple pixel‑intensity check to find the darkest point.

Step 4: Find the Sliding Point

The approach sums the RGB values of each pixel; the smallest sum indicates the darkest (most likely missing) spot.

Step 5: Perform Human‑Like Sliding

The sliding action uses WebDriver’s actions API, moving the mouse to the slider button, pressing, and then moving it in many small steps with random offsets and durations to mimic human behavior.

const button = await driver.findElement(webdriver.By.css('.geetest_slider_button')); const buttonRect = await button.getRect(); let actions = driver.actions({async: true}); actions = actions.move({x: x+10, y: y+10, duration: 100}).press(); await actions.move({x: x+10+point.x-5, y: y+10, duration: 1000}).release().perform();

To generate the step sequence, the author defines helper functions:

function getRandomDistribution(total, count) { let item = total / count; item = item + _.random(-item*2, item*3); item = parseInt(item); if (count === 1) { return [total]; } else { return [item].concat(getRandomDistribution(total - item, count - 1)); } } function getSteps(total, count) { const distribution = getRandomDistribution(total, count); return _.map(distribution, (item, i) => _.sum(distribution.slice(0, i + 1))); }

Despite extensive attempts to randomize the trajectory, the Geetest system still detects non‑human patterns, highlighting that matching the puzzle image is only a necessary condition; reproducing realistic sliding dynamics remains the core challenge.

Finally, after many trials, the script occasionally succeeds, displaying a green banner that welcomes the user as a human.

JavaScriptautomationsecuritycaptchaSeleniumwebdriverGeetest
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.