DEV Community

ProxyMaster
ProxyMaster

Posted on

A Selenium Proxy Setup That Survives Anti-Bot Checks

When you drive a browser with Selenium, every request goes out from one address. That is fine for a handful of page loads. It stops being fine the moment you scrape a few hundred product pages, log into several accounts, or hit a site that watches for automation. The server sees a single IP firing requests faster than any human hand could, and it reacts. First you get a CAPTCHA. Then you get rate limited. Then the address is blocked outright, and your script sits there staring at a challenge page it cannot solve.

The core problem is not Selenium. It is that one IP carries all the load and all the reputation. If that address gets a bad score, every session dies with it. The fix is to route traffic through proxies, spread the load across many addresses, and pick addresses that do not already look like a bot farm.

Attaching a proxy to Selenium

For a plain proxy with no login, you can pass it straight into Chrome options.

from selenium import webdriver
from seleniumwire import webdriver as wire_webdriver

# Simple proxy, no auth:
opts = webdriver.ChromeOptions()
opts.add_argument("--proxy-server=http://PROXY_HOST:PORT")
driver = webdriver.Chrome(options=opts)

# Proxy that needs user:pass (use selenium-wire):
wire_opts = {
    "proxy": {
        "http": "http://user:pass@PROXY_HOST:PORT",
        "https": "http://user:pass@PROXY_HOST:PORT",
        "no_proxy": "localhost,127.0.0.1",
    }
}
driver = wire_webdriver.Chrome(seleniumwire_options=wire_opts)
driver.get("https://api.ipify.org")
print(driver.page_source)
Enter fullscreen mode Exit fullscreen mode

The reason for two paths is authentication. Vanilla Chrome cannot send a proxy username and password through a command line flag without popping a native dialog that Selenium cannot type into. The selenium-wire package handles the auth handshake for you, which is why most real setups reach for it once credentials are involved.

That last line, loading an IP echo endpoint and printing the result, is your verification step. Do it on every fresh session. If the printed address matches your proxy and not your own connection, the route works. If it still shows your real address, the proxy silently failed open and you would have been scraping under your own name the whole time.

Rotating and choosing addresses

Verification tells you the proxy works. Rotation keeps it working. Instead of hammering one exit address, you cycle through a pool so no single IP builds up a suspicious request rate. You can rotate per session, per N requests, or on every block you detect. A rotating endpoint that hands you a new address automatically saves you from managing a giant list by hand.

Now the part that decides whether any of this holds up: address type. Datacenter IPs are cheap and fast, but they come from ranges that anti-bot vendors have mapped and scored for years. Many sites flag them on sight. Residential and private addresses look like ordinary home connections, so they pass checks that datacenter ranges fail. When a target is serious about blocking automation, the address type matters far more than how clever your code is.

Where to get proxies that survive checks

This is where the proxy source does the heavy lifting. WinGate proxies for Selenium give you private IPv4 and SOCKS5 with built in rotation, drawn from a worldmix pool so your addresses do not cluster in one obvious block. Traffic is unlimited, so you never throttle a long scrape to save quota, and the setup supports HTTP, HTTPS, and SOCKS5 with up to 5,000 concurrent threads for heavy parallel jobs.

The practical way to test whether this fixes your CAPTCHA problem is to point Selenium at it and watch the challenge pages disappear. There is a free 2-hour trial with no commitment, so you can plug the endpoint into the code above, run your verification print, and confirm the exit address rotates before you decide anything. Attach, verify, rotate, and choose the right address type, and your Selenium scripts stop tripping over checks they were never meant to fight.

Top comments (0)